From abef212b4d1ba6896bc3dfa2db5eec73c11fe71f Mon Sep 17 00:00:00 2001 From: Daniel Salvadori Date: Fri, 23 Jul 2021 11:48:27 -0300 Subject: [PATCH] Fix sprite negative scale --- graphic/sprite.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/graphic/sprite.go b/graphic/sprite.go index 610dd892..bd45673b 100644 --- a/graphic/sprite.go +++ b/graphic/sprite.go @@ -71,8 +71,17 @@ func (s *Sprite) RenderSetup(gs *gls.GLS, rinfo *core.RenderInfo) { // Removes any rotation in X and Y axes and compose new model view matrix rotation := s.Rotation() - rotation.X = 0 - rotation.Y = 0 + actualScale := s.Scale() + if actualScale.X >= 0 { + rotation.Y = 0 + } else { + rotation.Y = math32.Pi + } + if actualScale.Y >= 0 { + rotation.X = 0 + } else { + rotation.X = math32.Pi + } quaternion.SetFromEuler(&rotation) var mvmNew math32.Matrix4 mvmNew.Compose(&position, &quaternion, &scale)