Jump to content
  • Advertisement
Sign in to follow this  
domin

World space rotation / local space rotation

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

Hi, I have following question: how to determine both _Rotation and _RotationMatrix when UseLocalAxes is true? When UseLocalAxes = false everything is ok, but transformation are done in WORLD space of course...
void CNode::Rotate(const D3DXVECTOR3& Value, bool UseLocalAxes)
{
  if (UseLocalAxes)
  {
    // ???
  }
  else
  {
    _Rotation += Value;
  
    D3DXMatrixRotationYawPitchRoll(&_RotationMatrix, _Rotation.y, _Rotation.x, _Rotation.z);
  }
}

void CNode::SetRotation(const D3DXVECTOR3& Value, bool UseLocalAxes)
{
  if (UseLocalAxes)
  {
    // ???
  }
  else
  {
    _Rotation = Value;
  
    D3DXMatrixRotationYawPitchRoll(&_RotationMatrix, _Rotation.y, _Rotation.x, _Rotation.z);
  }
}

Share this post


Link to post
Share on other sites
Advertisement
You won't be able to using D3DXMatrixRotationYawPitchRoll, since the rotation order needs to be reversed in order for it to appear as though you're using the local frame instead of the world frame. However if you build the rotation matrix out of the X, Y, and Z axis rotations, then you could easily reverse them. So YXZ is the order you want when using the world frame, and ZXY is the order you want when using the local frame.

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!