PVRTMat4::LookAtRH * transformation * rotation question

This topic contains 2 replies, has 2 voices, and was last updated by  Joe Davis 4 years, 10 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #31070

    Dev2rights
    Member

    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 ?

    #36390

    Dev2rights
    Member

    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.

    #36391

    Joe Davis
    Member

    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

Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic.