Jump to content
  • Advertisement

Archived

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

stanislavk

3d movement question

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

I am a little bit confused about movement in 3d space. Lets say I have an object at position (x,y,z) and I have a movement vector V and lets say I want to think of movement in terms of meters/sec and my vector''s magnitude is in meters/sec. How would I use my positions and my movement vectors, and how would I set up the viewing space(OpenGL) so that my objects move with the specified speeds. I guess what im saying is how would I scale meters into pixels just say that one pixel is one meter? I am wondering how this is done in professional games.

Share this post


Link to post
Share on other sites
Advertisement
You don''t scale to pixels, the rendering pipeline will eventually do that for you.

If you have a velocity vector V, then the movement for that object for a frame is this:

r1 = r0 + V*t

wher r1 is the new position vector, and r0 is the current position vector, and t is the elapsed time. Make sure the units are all compatible and it''s easy. When you render the object, you use r as it''s translation.

And you change the direction of V (as well as the camera) whenever they turn.

Magmai Kai Holmlor
- Not For Rent

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!