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


3d movement question

Recommended Posts

stanislavk    122
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
Shannon Barber    1681
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