- Home /
Flipping ( localscale/rotate unfitting )
Hello everybody. It would seem i have stumbled upon a dilema. I want to flip my character in the y axis in my 2D game (bird's eye view). There are two techniques. The first one causes problem in the physics department ( as mentioned in various other threads ) when used ( e.g onCollisionExit2D behaves sketchy afterwards ). It is the one below
Vector3 theScale = transform.localScale;
theScale.x *= -1;
transform.localScale = theScale;
The other one doesnt seem to cause any physics problems but a) doesnt seem to work for the y axis specifically for some reason while it does on others and most importantly b) requires that 'fixed angle' is unchecked. That means the x and z angles would have to be set to 0 in every fixed update and that seems a little buggy when i tried it. The method:
facingRight = !facingRight;
transform.Rotate(Vector3.up*180);
What are your suggestions/ideas and how do you perform flips on your characters? Thank you all for being awesome :)