Jump to content
  • Advertisement
Sign in to follow this  
Matrlx

x/y-axis rotation using MDX Sprite?

This topic is 4077 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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!