Jump to content
  • Advertisement


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


Moving Objects Per Yaw/Pitch/Roll

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

Hello everyone, This is giving me a headache, I''m hoping someone can clarify. I have a model (A), it tracks Yaw, Pitch and Roll locally in its class. It also has a velocity, which is regularly updated based on speed changes etc. What I would like to know is this: How do I rotate the model based on its Yaw/Pitch/Roll (I can do this easily), BUT, how do I apply the velocity so that it always moves in the right direction in 3D space based on these values? I built a D3D camera class, and so I can fly around freely using the cursor keys and can rotate/yaw/move forward. I took a lot of this code out of the SDK, so the camera velocity, moves the camera forward with the Z value of the velocity vector, regardless of the angle the camera is at. I tried to take this over and do the same with models, so that when I change the Z value of its velocity, it moves through the world space based on its yaw/pitch/roll values? This would be very helpful, its giving me a headache. What am I missing? Warmest Regards to all, Goatie

Share this post

Link to post
Share on other sites
If you wish to move along the vector derived from your yaw, pitch, roll, then just create a yaw, pitch, roll rotation matrix, apply it to some standard forward vector (<0,0,1> or something similar), take the resulting vector, make sure it''s normalized, and move your object along that.

i.e. (in C#)

float velocity;
Vector3 Position;

Matrix rot = Matrix.RotationYawPitchRoll(yaw, pitch, roll)
Vector3 stdForward = new Vector3(0,0,1);
Position += stdForward * velocity;

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!