Archived

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

Calculate a Vertex from an Angle

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

What I have is a Position Vertex, Heading, Pitch, and an Angle. I want to be able to move around on the X,Z plane. (Moving forward) I think I need to grab another Vertex (View) by using the Angle and Position, and then do something like this: TempVector.SetX(Position.GetX() - View.GetX()); TempVector.SetZ(Position.GetZ() - View.GetZ()); Position.SetX(Position.GetX() + TempVector.GetX() * Speed); Position.SetZ(Position.GetZ() + TempVector.GetZ() * Speed); Am I on the right track? Or is there some other way of doing this? P.S. This is how the Camera is set up. glRotatef(-Pitch, 1, 0, 0); glRotatef(-Heading, 0, 1, 0); glTranslatef(-Position.GetX(), -Position.GetY(), -Position.GetZ()); I got the idea from: http://www.mindcontrol.org/~hplus/graphics/simple-gl-camera.html

Share this post


Link to post
Share on other sites