orienting an object in 3d space

Started by
0 comments, last by JustinHust 21 years, 2 months ago
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
Advertisement
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
It's not what you're taught, it's what you learn.

This topic is closed to new replies.

Advertisement