Skip to content

Instantly share code, notes, and snippets.

@johngirvin
Created April 28, 2017 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johngirvin/a60ae7f164d3490ff79f902cf2759eab to your computer and use it in GitHub Desktop.
Save johngirvin/a60ae7f164d3490ff79f902cf2759eab to your computer and use it in GitHub Desktop.
diff --git a/Source/MonoGame.Extended.Entities/Entities/TransformComponent2D.cs b/Source/MonoGame.Extended.Entities/Entities/TransformComponent2D.cs
index 9f025a1..9a25f7f 100644
--- a/Source/MonoGame.Extended.Entities/Entities/TransformComponent2D.cs
+++ b/Source/MonoGame.Extended.Entities/Entities/TransformComponent2D.cs
@@ -167,7 +168,7 @@ namespace MonoGame.Extended.Entities
if (Parent != null)
{
Parent.GetWorldMatrix(out matrix);
- Matrix2D.Multiply(ref matrix, ref localMatrix, out matrix);
+ Matrix2D.Multiply(ref localMatrix, ref matrix, out matrix);
}
else
{
@@ -177,18 +178,9 @@ namespace MonoGame.Extended.Entities
private void RecalculateLocalMatrix(out Matrix2D matrix)
{
- if (Parent != null)
- {
- var parentPosition = Parent.Position;
- matrix = Matrix2D.CreateTranslation(-parentPosition) * Matrix2D.CreateScale(_scale) *
- Matrix2D.CreateRotationZ(-_rotation) * Matrix2D.CreateTranslation(parentPosition) *
- Matrix2D.CreateTranslation(_position);
- }
- else
- {
- matrix = Matrix2D.CreateScale(_scale) * Matrix2D.CreateRotationZ(-_rotation) *
- Matrix2D.CreateTranslation(_position);
- }
+ matrix = Matrix2D.CreateScale(_scale) *
+ Matrix2D.CreateRotationZ(_rotation) *
+ Matrix2D.CreateTranslation(_position);
}
[Flags]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment