Jump to content
  • Advertisement
Sign in to follow this  
Halsafar

3rd Person Camera - Quaternion - One problem.

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

I created a nice 3rd person camera. Using quaternions I can rotate any axis either around a point or rotateing the camera eye as to look around without moving. It I have the camera dictate its target (move the target exactly with the eye by using unit vectors) then it all works just fine. It looks beautiful...But of course that is not how it should be. The players position should dictate the camera's target and the camera class should be able to place the eye accordingly. This is where my problem occurs, if I move the player forward and then move the camera forward by the same speed because I have to move the camera using a unit vector the camera looses distance on the player even though they are moving at the same speed. So if I move forward just a plain distance between the (target - eye) then the eye is always at the players head... How on earth do I position the camera eye behind the camera target. This is my first attemp: m_Eye.x = m_Target.x - (m_VectorCircle[m_Angle].u * m_Away) * (m_VectorCircle[m_UpAngle].u); m_Eye.y = m_Target.y + (m_VectorCircle[m_UpAngle].v * 20); m_Eye.z = m_Target.z - (m_VectorCircle[m_Angle].v * m_Away) * (m_VectorCircle[m_UpAngle].u); .u and .v being the sin of and cos of (m_VectorCircle is a lookup table) Of course that works, but it is not the correct way to simulate a 3rd person camera....Although it does provide the eye to ALWAYS be behind the player. But it is not proper. How do I do it using vectors?

Share this post


Link to post
Share on other sites
Advertisement
I move the player just like the tiny code snippet i posted above.

The camera though just needs to stay behind always....ugh

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.

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!