Flipping method approach

First of all sorry for asking a simple and a little bit out of topic questions.
As far as i know there are 3 methods that can be applied to flip a character “sprite”

  • first, transform the local rotation to 180 in y-axis to flip horizontally or in x-axis to flip vertically .
  • second, transform the local scale in x-axis to flip horizontally ( like what Rick did in the course) or in y-axis to flip vertically.
  • third, using boolean flipX to flip horizontally and flipY to flip vertically in SpriteRenderer ( this method not applicable in older version of unity )

my questions are as follows :

  • are there any differences between those methods in term of speed, complexity, condition, or any other aspect ?

  • If there are, in what conditions that we should apply each of the methods above ?

Thank you very much, i am sorry if there are any mistakes in my questions and sorry for my bad english :grin:

Um…I wanna get the answer either.:nerd_face:

First, cost of a rotation and take into account the change of direction.

Second, change scale affect collider then more calculation for the physic engine.
For Unity Dev, scale different of (1, 1, 1) must be an exception.
Ideally all object of a scene should have a scale (1, 1, 1).
But, scale method keept interesting if you have an asymmetric collider.

Third choice, the best choice in most of cases. The lesser cost. Create for that.

2 Likes

I used FlipX at this point in the tutorial… I’ve found messing with scale values tends to upset the physics in game engines (Godot and probably Unity too). Of course we’re still using 1:1 scaling… But it could cause issues.

In future if you want to fire a weapon you probably want to be changing the rotation so you’re actually facing in the direction you’re firing. Although being able to back up and fire would be pretty cool, too!

Privacy & Terms