- Home /
[2d]inversing scale modify position
Hello and sry for my bad english.
I have this curious problem :
I have a gameobject which need to flip when he hurts a wall.
For that i use the following code :
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
But when the Xscale is inversed, my Xposition is also modified and my gameobject teleport. I don't understand as i follow the unity platformer tutorial method and it's working in this project.
My gameobject is an empty gameobject with circle collider, animator and a script as component. He has 3 childrens which are the sprite element of my gameobject (body and 2 legs).
Does someone have an idea where it could come from ? Thanks in advance ! :)
Your answer
Follow this Question
Related Questions
Position + Vector3 doesn't return correct values 1 Answer
How can I move an object to a (0,0) and scale it to (0,0) at the same time? 1 Answer
How to drag-and-stretch a 2D sprite in local space? 0 Answers
UI: Positioning an element relative to another element with Scale With screen Size 4 Answers
Changing player's moving direction 0 Answers