Jump to content
  • Advertisement
Sign in to follow this  
WhatsUnderThere

3rd person chase-cam orientation

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

Right now im working on a project that is comparable to a flight simulator with a 3rd person chase camera. Both the jet and the camera are represented by 4x4 matrices--the camera still uses world coordinates in this form, I take the inverse before applying it as a transform later. Each frame, I update the orientation and the position of the jet based on input, and then I have to update the camera accordingly. First I find the direction the camera should point (basically, the negative Z axis), by subtracting the camera's position vector from the jet's position vector, and then scaling it to one by dividing by the distance--no problem. Then I update the position of the camera by simply moving it along this new Z axis, to the desired distance from the jet. However, the problem arises once I want to find the X/Y axis for the camera's orientation matrix. Because the jet is able to rotate freely along its local X and Y axis, my jet's and camera's up-vector is not a constant <0,1,0>. I can find the equation for the XY plane of my camera since I have the Z axis vector, but how can I separate this into the X and Y components of my camera matrix, such that it follows the orientation of my jet?

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!