Jump to content
  • Advertisement
Sign in to follow this  
Supernat02

LOS Vector Problem

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

Hi, I have the following problem and would appreciate any help. Thanks. I have a spaceship with 6 degrees of freedom, indicated at any given time by yaw, pitch, and roll angles. I have a camera attached to the spaceship with the ability to move in a limited FOR. For simplicity, the camera is at the center of the spaceship and doesn't have the spaceship model in its view. I don't keep track of the camera's yaw, pitch, roll angles with respect to the spaceship, but I do calculate them with respect to the global coordinate system (XYZ axes). I also know the global az/el values. What I want to know is the az/el values with respect to the spaceship. For instance, no matter which way the spaceship is facing or rotated toward, the camera is still 10 degrees down and 10 degrees right because it is attached to the spaceship. I know it has something to do with a transformation. Please tell me if my idea is right or wrong if you can. I take the global az/el values, create a vector from them, transform that vector by the inverse of the spaceship's roll/pitch/yaw matrix, then convert the new vector back to az/el. Is it that simple? Do I have the order of rotations right? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
You have the "global" orientations of the spaceship, S, and the camera, C, and you are looking for the orientation of the camera relative to the spaceship -- a value of M that satisfies this equation: S = CM (assuming column vectors). Solve for M:
    S = CM
C-1S = C-1CM
C-1S = M
BTW, with 6 DOF, you are going to run into problems (specifically "gimbal lock") if you keep track of your spaceship's and camera's orientations using yaw, pitch, and roll.

Share this post


Link to post
Share on other sites
I don't use yaw, pitch, and roll to keep track of it. They are calculated from direction cosines. The approach I wrote (pretty sure it's the same equation you suggested) worked.

Thanks!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!