I’ve got a baffling issue - I have a flying enemy in my game with a child BoxCollider2D sticking out, rotated on the Z axis at an angle as if looking with a search beam. It works great! Until I flip the enemy by scaling the parent’s X to -1. For some reason that makes the BoxCollider2D a lot smaller, and its rotation doesn’t change (though its position does). It’s like it’s rotating on the wrong axis somehow. If I cheat and flip the enemy by instead rotating the parent 180 degrees on the Y axis (as if it were 3D), that looks correct in the editor, but then the BoxCollider2D doesn’t register collisions (which makes sense, it’s not designed for 3D rotations).
The way that collider rotated really looks like a familiar bug in 4.3. If that’s correct and you can’t upgrade, one thing that works well is to make the collider in the same GameObject as the -1 x-scale.
I’m using 4.5.3, and doing Trigger collisions. Unfortunately, I can’t make the collider in the same GameObject as the -1 x-scale because then I’d have to rotate that object, plus that object needs its own box collider for detecting being shot or running into a wall.
I really need to get this working tomorrow, so I guess I’m gonna have to go with a really crappy hack: have an empty parent object that does nothing and give it two children: a child that is the visual thing that controls motion and needs to flip (it’ll have to change parent.position when it wants to move), and a child that is the scanner with its rotated collision (and have the visual child tell it to rotate to face the other direction when flipping).
What sucks is, this is the kind of thing that will happen to TONS of 2D games, because it’s rather common to need to flip a character in a 2D sidescrolling game.
No, as I responded when you asked about it, I’m using Unity 4.5.3, which is the current version available to download. There is a patch for 4.5.3, but no fix for this is mentioned in the patch notes. And I found another post about a similar issue, that stated that this has not been fixed, apparently they added a fix for colliders but not triggers.