Guest User

Untitled

a guest
Oct 21st, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. Vector2 centre = new Vector2(Engine.VriskaEngine.GraphicsDevice.Viewport.Width / 2,
  2. Engine.VriskaEngine.GraphicsDevice.Viewport.Height / 2);
  3.  
  4. //Translate to the centre
  5. Matrix originTranslation = Matrix.CreateTranslation(new Vector3(-centre.X, -centre.Y, 0));
  6.  
  7. Matrix rotationMatrix = Matrix.CreateRotationZ(MathHelper.ToRadians(Rotation));
  8.  
  9. Matrix zoomMatrix = Matrix.CreateScale(new Vector3(zoom, zoom, 1));
  10.  
  11. Matrix translateBackToPosition = Matrix.CreateTranslation(new Vector3(centre.X, centre.Y, 0));
  12.  
  13. Matrix newTranslate = Matrix.CreateTranslation(new Vector3(Position, 0));
  14.  
  15. TransformMatrix = originTranslation * rotationMatrix * zoomMatrix * translateBackToPosition
  16. * newTranslate;
Add Comment
Please, Sign In to add comment