Archived

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

Zymran

Quaternion Orientation

Recommended Posts

Zymran    124
Hi, Having a problem getting a grip on Quaternion rotations in the 3D engine I am using (Axiom). Most of the examples I see on the net talk about adding arbitrary amounts of rotation to a 3D object''s quat to rotate it. In my case, I need to achieve a specific orientation. Basically, heres what I am trying to do. I am working on a Spaceship Combat Sim (Capital Ships), and I am trying to have the ships rotate to face their enemy. All the ships have a ton of information available including Position Vector (relative to origin), and Quaternion orientation. They also contain positional data as Matrixes, but I was thinking that manipulating the Quaternion would be less expensive from a performance standpoint. However two problems arise: 1) I can only get the ship to orient when its at the origin properly. 2) Even at the origin, the ship rolls on it''s side as it orients past 90 degrees. Given that you know Your Position (3part vector), your Orientation (Quat) and the Enemy Position (another Vector3), how do you come up with a Quaternion to desctibe the new orientation? If I know this, the engine already has functionality in it to smoothly rotate from one Quat to another Quat. PS, there is also a "Direction Vector" available on all 3D objects if this is helpful. Thanks for reading.

Share this post


Link to post
Share on other sites