Jump to content

  • Log In with Google      Sign In   
  • Create Account


#ActualMorphex

Posted 31 December 2012 - 12:45 PM

if (Position != position || Scale != scale || Origin != origin || Rotation != rotation)
{
scale = Scale;
origin = Origin;
rotation = Rotation;
position = Position;
transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *
Matrix.CreateRotationZ(Rotation) *
Matrix.CreateScale(new Vector3(Scale, 1)) *
Matrix.CreateTranslation(new Vector3(-Origin, 0));
}

 

 

This is exactly what I use, it works fine. Rotates around the center, zooms, translates, everything you wish for smile.png

EDIT: Origin is just your screen center. so in a 800 * 600 window, it is 400,300 vector.


#3Morphex

Posted 31 December 2012 - 12:45 PM


  if (Position != position || Scale != scale || Origin != origin || Rotation != rotation)
                {
                    scale = Scale;
                    origin = Origin;
                    rotation = Rotation;
                    position = Position;
                    transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *
                                         Matrix.CreateRotationZ(Rotation) *
                                         Matrix.CreateScale(new Vector3(Scale, 1)) *
                                         Matrix.CreateTranslation(new Vector3(-Origin, 0));
                }

This is exactly what I use, it works fine. Rotates around the center, zooms, translates, everything you wish for smile.png

EDIT: Origin is just your screen center. so in a 800 * 600 window, it is 400,300 vector.


#2Morphex

Posted 31 December 2012 - 12:44 PM

if (Position != position || Scale != scale || Origin != origin || Rotation != rotation)                {                    scale = Scale;                    origin = Origin;                    rotation = Rotation;                    position = Position;                    transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *                                         Matrix.CreateRotationZ(Rotation) *                                         Matrix.CreateScale(new Vector3(Scale, 1)) *                                         Matrix.CreateTranslation(new Vector3(-Origin, 0));                }

This is exactly what I use, it works fine. Rotates around the center, zooms, translates, everything you wish for smile.png

 

EDIT: Origin is just your screen center. so in a 800 * 600 window, it is 400,300 vector.


#1Morphex

Posted 31 December 2012 - 12:42 PM

  if (Position != position || Scale != scale || Origin != origin || Rotation != rotation)
                {
                    scale = Scale;
                    origin = Origin;
                    rotation = Rotation;
                    position = Position;
                    transform = Matrix.CreateTranslation(new Vector3(-Position.X, -Position.Y, 0)) *
                                         Matrix.CreateRotationZ(Rotation) *
                                         Matrix.CreateScale(new Vector3(Scale, 1)) *
                                         Matrix.CreateTranslation(new Vector3(-Origin, 0));
                }

 

This is exactly what I use, it works fine. Rotates around the center, zooms, translates, everything you wish for :)


PARTNERS