Sign in to follow this  

x/y-axis rotation using MDX Sprite?

This topic is 3860 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'm trying to rotate sprites around the x/y axis. It can rotate around the Z axis just fine, but whenever I try to set a Yaw or Pitch that is anything but zero, the sprite disappears. Am I doing something wrong here or is it just not possible with the Sprite class in D3D?
            //rotation
            Quaternion rotate = new Quaternion();
            rotate.RotateYawPitchRoll(rotation.X, rotation.Y, rotation.Z);
           
            //scaling
            Vector3 scale = new Vector3(scaling.X / _w, scaling.Y / _h, 1.0f);
            
            D3DSprite.Transform = Matrix.Transformation(
                new Vector3(position.X, position.Y, 0), //scales from top left
                Quaternion.Identity,
                scale, 
                new Vector3(position.X + scaling.X / 2, position.Y + scaling.Y / 2, 0.0f), //rotates from center
                rotate, 
                Vector3.Empty);

Share this post


Link to post
Share on other sites

This topic is 3860 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this