Jump to content
  • Advertisement

Archived

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

Mr_Ridd

3d Character Rotation

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

Howzit I''m using OpenGL. I''ve got this scenario. I''ve got a 3D model of a man, he has a facing angle. I''ve also got a point of origin and if I click then I have a point to which he must go. I''m making it so the whole screen moves, not just the character. What I want to know is how to rotate the character so he is facing in the direction where I clicked the mouse. I can use glRotatef but I first have to get the angle to move. He must also rotate to the point, not just flip. Shot

Share this post


Link to post
Share on other sites
Advertisement
Well, that involves a number of things. First, I am guessing that though the frame is 3d, the man moves in a 2Dimentional manner- aka he walks around the x-y plane. How are you creating your 2D point from the click in 3D space?


Anyhow, once you get your point, you can use an assortment of methods to finding out the angle between two vectors ( http://www.gamedev.net/community/forums/topic.asp?topic_id=102671 ), such as dot product, cross product, or good ol'' atan.


since im @ school w/ nothing better to do, here''s a pic =P

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!