Jump to content
  • Advertisement
Sign in to follow this  
Ender2012

Looking for a good way to move a model in 3D

This topic is 3733 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey I have an F16 model that I am trying to move around in 3D with the arrow keys. I draw the plane by giving it's xyz location, direction vector, and up vector. I am trying to figure out a good way to move the plane around my skybox in 3d using the arrow keys probobally left and right to pivot in the X plane forward and backward to move to and fro in the direction it is pointing and pgdn and pgup to pivot in the y plane. I am currently using gllookat() to view the model. I have tried a couple different options but nothing worked out right. Anyone have an easy way to do this?

Share this post


Link to post
Share on other sites
Advertisement
Try a combination of glRotate and glTranslate or use your own transformation matrices. Basically it's just a matter of matrix multiplication.

You move the plane and move the camera with it. The skybox isn't moved at all (identity modelview transformation, except camera rotation).

Share this post


Link to post
Share on other sites
I am trying to use a rotation matrix and I want to change direction by modifying Dx. What I originally did was start the plane point Dx 1 and Dz 0 so it was pointing directly in the direction of the positive X. Then when you press left I would have it decrease Dx by the same amount that I decreased Dz so eventually when you got to be pointing directly in the negative Z direction your Dx was zero and Dz was -1. My problem was that I was also using Dx and Dz to set up my gluLookat() (I had X Y Z for my object coords and I was set (Ex = eye x) Ex = X - 7*Dx and so on for the rest) basically I was trying to use this to know where to look but my problem was when Dx or Dz was zero you couldn't see the object at all and when Dx approached 1 it got very far away. How would I do this and maintain a constant eye position relative to the object?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!