Jump to content
  • Advertisement
Sign in to follow this  

Rotating around y-axis for 1.57radian

This topic is 999 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've got an object with +ve x facing front in local space.
when I rotate the object by D3DXVECTOR3(1.57,0,0),
it is lying on the ground sideways,
So I think it should rotate around the y-axis instead to get it facing south
because y-up axis is facing up in DirectX.
I think it must be correct. But indeed it has no effect.
The object is still facing East, not facing South.
Why is this happening?

I debug the transformation at the final stage of setting world transformation.

the rotation vector is D3DXVECTOR3(0,1.57,0)

and the matrix code is

void Mover::Transform(float time, float& localTime, D3DXMATRIX& matWorld,
                      const D3DXVECTOR3& scale, const boost::shared_ptr<cPoint> pos,
                      const D3DXVECTOR3& rot,
                      LPD3DXANIMATIONCONTROLLER pAnimCtrl,
                      const D3DXMATRIX* combinedMatrix,
                      const D3DXVECTOR3& scaleCenter,
                      const D3DXVECTOR3& rotCenter) {
    localTime += time;


    if (rot.x != 0.0f || rot.y != 0.0f || rot.z != 0.0f)
        D3DXQuaternionRotationYawPitchRoll(&quatRot, rot.x, rot.y, rot.z);
        D3DXMatrixTransformation(&matWorld, &scaleCenter, NULL, &scale,
            &rotCenter, &quatRot, &pos->m_vec3);
    else {
        D3DXMatrixTransformation(&matWorld, &scaleCenter, NULL, &scale,
            NULL, NULL, &pos->m_vec3);

    // check if current object is attach to other object
    // check if m_matWorld = *m_pCombineFrameMatrix works
    if (combinedMatrix != NULL)
        matWorld *= *combinedMatrix;

    if (pAnimCtrl != NULL) {
        pAnimCtrl->AdvanceTime(time, NULL);




Sorry, found the bug, no problem with D3DXVECTOR3(1.57,0,0)

but since I've got some impurities in the rotation of the physics subsystem.

The object was tilted and fell over to the ground





Edited by lucky6969b

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!