- Home /
Flip 2d character with rotation or scale?
I am working on a 2d platformer and I wanted to know if I should flip the character by changing the x scale to -1 or rotating it 180° on the y axis. I am currently doing it by scale but I'm having trouble because I can't use transform.right to get the direction of the character. So should I rotate it instead or are there any advantages with flipping it by changing the scale?
Answer by rage_co · Jul 06, 2021 at 03:51 AM
Rotating the character with rotation will not work with any character with only one line of symmetry (aka any humanoid)......and using scale can flip...all the transform properties which is undesirable while dealing with scripts....i suggest using the flip property with the sprite renderer of your player......you just need to reference the SpriteRenderer.......and then set SpriteRenderer.flipX to true or false depending on your needs....it also has a .flipY property but i doubt you need it in that case....just leaving it here in case you do....hope this helps
Your answer
Follow this Question
Related Questions
Why my instantiated 3d text is flipped? 5 Answers
Mirroring texture inside GUI.Button 0 Answers
How to flip based on x pos properly? 1 Answer
Flip 2D object on X axis because of a moving target. 1 Answer
Problem with counting front flips 1 Answer