but have you ever tried using negative scale in unity? it works just fine, It’s also recommended for flipping 2d sprites in this unity published tutorial : http://unity3d.com/learn/tutorials/modules/beginner/2d/2d-overview
The bug described in this thread is not related to negative scaling, it’s reproducible without even scaling to a negative factor, it’s not even tied to 2D colliders, it’s just that 2D colliders are more limited than 3D colliders as you can’t rotate them around the Y axis
the funny thing: I just found a solution while writting this post as I tried to verify that Y-Axis rotation statement I just made on 2D colliders (which I also read on another 2d sprite negative-scaling thread).
Ziv03: try to replicate this and let me know if it works
I create an emtpy gameObject called Robot with the following components: Animator, Animation, Rigidbody 2D and a script “robotControl” which I made for controlling the robot.
then I create another empty GameObject called “RobotModel” with no components, and make it child of “Robot”.
Finally, I put all the 2D sprites as childs of RobotModel.
the tree looks like this:
Robot
|__ RobotModel
|__ head
|__ neck
|__ torso
|__ left leg
|__ right leg
|__ left arm
|__ right arm
Be carefull not to use any Box Collider 2D on those sprites… use only Polygon Collider 2D, and shape them as boxes if you wish, but don’t put Box Colliders 2D !!
now, instead of scaling -1 the “Robot” X-Axis, you just do rotate RobotModel Y-Axis in 180 degrees everytime you want to flip the sprites.
Note: if the sprites have different Z positions for layering, then you will also have to invert their sign by script so layering is preserved as well.
voila! it works for me.
so you can’t use box colliders 2D which is more optimized than polygon collider 2d… but … this is still much better than using 3D colliders in the first place or scripting the colliders position/rotation on each frame as other workaround suggest… and you can still use a rigidbody.
this is the best solution I came so far…please let me know if you find any limitations on it or if it works fine with you too.
regards,