Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


controlling an object with vectors

This topic is 5305 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

Okay so I have developed an object(airplane) but that doesnt matter. I record the x,y,z and its velocities the create vectors from that. I have to calculate the new x,y,z positions. I was thinking is it better to actual translate a vectore apply a movement vector to it, then grab the result x,y, and z? Which is the best(politically correct) way? thanks, nick

Share this post

Link to post
Share on other sites
Are you talking about translating a vector by a certain velocity vector? If so, it''s a little more complicated (but not very) than adding them together. Just run your velocity vector through D3DXTransformNormal(), and then add it to your position vector. Like this:
// posVec is the position vector
// velVec is the velocity vector
// matOrientation is the orientation matrix / inverse view matrix
D3DXVec3TransformNormal( &velVec, &velVec, &matOrientationn );
posVec += velVec;
To see an implementation of this, look at the UpdateCamera() function in the Cull sample.

Dustin Franklin
Mircrosoft DirectX MVP

Share this post

Link to post
Share on other sites

  • 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!