Jump to content
  • Advertisement


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


orienting an object in 3d space

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

So now I''ve got a free-roaming camera that can pitch, roll, and yaw thanks to the great camera article in Game Programming Gems I. But now, I tried to apply the same system to a game entity with an arbitrary position, and this no longer works. The function presented in GPG for deriving a forward, up, and side vector from a pitch, roll, yaw always assume that your pitch, roll, and yaw are based around the origin (perfect for a camera). But when you start dealing with entities things get tricky because you''re going to yaw a bit to one side, then pitch by that new side vector at an arbitrary point in space. I realize I could get this to work very simply using quaternions for entity orientations BUT I need to be able to get the entity''s forward, up, and right vectors to do things like strafe along the side vector or launch projectile in the entity''s forward vector. Can anyone explain a way to do this? Thanks, Justin

Share this post

Link to post
Share on other sites
The way I handled it was storing the object''s orientation in a structure of my own, and using that to perform its rendering.

This isn''t the only way to handle it, but for me, it works.

This page I wrote deals only with OpenGL. Hopefully, you''ll get some hints from it:

3D Orientations in OpenGL

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!