Enemy [parent] ← being the one I flip via localScale.x=-1
-body
-jaw
-left_arm
-right_arm
-left_leg
-right_leg
-head
I understand it’s an issue with non-uniform scaling so I tried changing that to the following and flipping the CHILDREN instead of the parent:
Enemy [parent]
-jaw
-left_arm
-right_arm
-left_leg
-right_leg
-head
TomasJ: Rotating on the Y causes weird issues. The dinosaur is made up of several sprites arranged on the Z layer. Rotating Y to 180 makes his left leg in front of the right, etc. You can fix the look by inverting the Z position BUT the colliders don’t move with the sprites:
I read something the other day by someone on your team, I believe Eric, saying that you should only rotate sprites on the Z axis in a 2D environment. Obviously you can’t “flip” a sprite by rotating it on the Z.
Hi Brutang, turns out I was wrong (as you know) with the version, it wasn’t that it started working for me, it’s because I changed to using the polygon collider, which does rotate correctly. It’s not ideal, but it’s workable till they fix it, and you can easily delete points to get it down to a similar number or verts, tho I couldn’t say how it compares in performance!
The colliders are all Polygon Collider 2Ds; 6 of them. Rotating on the Y or flipping the parent via localScale.x=-1 both cause issues. Flipping via localScale causes non-uniform scaling issues (like shrinking/expanding depending on rotation) and rotating on the Y doesn’t adjust the colliders (as shown in the image).
I’d love to see how you do it via code or an image as I’m at a loss for how to fix this!
I had collider issues when flipping things but I found I had to… kind of rotate things in a weird way.
Pause the game and in the editor play with the rotational values to see if you find what works.
I had to do a Quaternion.Euler(0, 90, 270) if the object was on the left and a Quaternion.Euler(0, 270, 90) if it was on the right to get the correct effects, depending on which direction something was instantiated then rotated via Quaternion.LookAt(x)
It’s the Rigidbody that messes it up, if you don’t have one, poly colliders rotates fine that’s why it was ok in my tests I did. Really annoying this one!
doing a localscale = -1 really messes with the colliders. It would take a working collider and instantly mess up the detection once the scale was reversed, I had to resort to rotation on y
I solved this by enabling and re-enabling the collider every time it’s rotation changes using the second method you described. An ugly fix, but it does the job.
i had all these issues on my previous project and i had to abandon it , not only colliders, joints go nuts as well, subscribed to this thread i hope unity fix it soon