Imagination PowerVR SDK Blog

PVRTMat4::LookAtRH * transformation * rotation question


#1

Hello,



Im having some trouble moving around a scene and have got a bit stuck. I create a projection matrix up for the " Camera " and multiply the models by this matrix to put them over the same space for each frame.



PVRTVec3 vFrom( 0, 8, 20 ), vTo( 0, 0, -20 ), vUp(0.0f, 1.0f, 0.0 );

m_mProjection = PVRTMat4::LookAtRH(vFrom, vTo, vUp) * PVRTMat4::RotationY( DEGREES_TO_RADIANS( m_WorldRot ));



But when i increment / decrement m_WorldRot it seems to rotate the projection around the origin of 0,0,0 and not the vector vFrom of vTo.



I want to rotate around the new look at point. What am i doing some thing wrong here ?


#2

I figured it out, as the matrices orient around the origin i needed to use Eulers theorem and translate the projection back to 0,0,0 then rotate and translate back to the world position. I should have known this as i did asteroids ages ago.


#3

Hi Dev2Rights,



You should refer to the Model View Project matrix calculations in one of our Examples (such as IntroducingPOD) for a clean, simple way of setting up the matrices in your scene.



Regards,

Joe