Jump to content

  • Log In with Google      Sign In   
  • Create Account

Correcting camera movement - with demonstrational video


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
1 reply to this topic

#1 Peter Wenig   Members   -  Reputation: 101

Like
0Likes
Like

Posted 22 September 2013 - 08:02 PM

I have a sphere as FBX and a shader that enables me to have a texture inside of the sphere. Also inside of the sphere I have a camera. The goal is to have a simple panoramic viewer that is being driven by a headtracker.

The texture is being shown but the camera is reacting in a weird way:

When rotating the headtracker, the image is all over the place, jittery and not at all correlated to the actual movements. The headtracker input itself is correct, though.

See this video for further clarification. Each time I keep the tracker steady at first and then I move it. In the second half, the first three numbers are evaluated. The other three values are gyro.

I presume the problem to be in the following code, something about the Vectors(Vector3.whatever) could be off:
 

protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.CornflowerBlue);

foreach (ModelMesh mesh in skyDome.Meshes)
{
foreach (BasicEffect ef in mesh.Effects)
{
float aspectRatio = (float)graphics.GraphicsDevice.PresentationParameters.BackBufferWidth / (float)graphics.GraphicsDevice.PresentationParameters.BackBufferHeight;

Vector3 camPosition = Vector3.Transform(Vector3.Up, Quaternion.CreateFromYawPitchRoll(drehung, neigung, rollen));
ef.View = Matrix.CreateLookAt(Vector3.Zero, camPosition,Vector3.Forward);
ef.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 0.1f, 10000.0f);
ef.TextureEnabled = true; //Textur zulassen
ef.Texture = panoramaTextur; //Textur auf Model darstellen
}
mesh.Draw();
}
base.Draw(gameTime);
}


Sponsor:

#2 Shuuny   Members   -  Reputation: 164

Like
0Likes
Like

Posted 06 November 2013 - 01:56 PM

something about the Vectors(Vector3.whatever)

 

That's not a good way to show your dedication to your own problem.

 

 

 

 

Vector3 camPosition = Vector3.Transform(Vector3.Up, Quaternion.CreateFromYawPitchRoll(drehung, neigung, rollen));

ef.View = Matrix.CreateLookAt(Vector3.Zero, camPosition,Vector3.Forward);

 

Neither of those seem to make any sense. Look up XNA's documentation for Matrix.CreateLookAt and spend some time studying what you are trying to accomplish there. Some transformation, matrix FAQ will be needed for you to complete this. There is plenty of DirectX tutorials going around about view matrices and basic matrix transformation, what it does, what do you accomplish with it and why.

 






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS