3rd Person Camera - Quaternion - One problem.

Started by
0 comments, last by Halsafar 19 years, 4 months ago
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?
Advertisement
I move the player just like the tiny code snippet i posted above.

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

This topic is closed to new replies.

Advertisement