So… Unity 4.5 Physics Updates has done… ahem… interesting things.
4.3.4 = 2D collider attached to an object. Rotate object on X axis. Since collider is 2D, it does not rotate. It completely ignores rotation since it exists in a 2D world.
4.5 = 2D collider attached to object. Rotate object on X axis. Collider2D will ‘shrink’ to a relative size as if the object were actually rotating, albeit still 2D ‘flat’. At 90 degrees X, collider is infinitely thin since you’re looking at a 2D object ‘plane’ in a manner of speaking, and will actually not trigger collisions at all.
Funny. Completely new behavior. Looks like all colliders will get their own gameobjects now.
Also… it seems to have fixed the inconsistent behavior of previous Physics2D where if you interpolated collision on a rigidbody, you absolutely could not rotate the Z axis of a transform that had a Collider2D attached.
So, perhaps before I go redoing a ton of stuff, I should ask - is this the new expected behavior, or is this an oversight?
To Test: Create gameobject. Attach 2D collider. Rotate X. Watch it shrink in scene view. At 90X, it’s effectively “gone”. Doesn’t even have to be running.
Haven’t created a bug because… I don’t know if it is a bug.
I got the same problem ,may be it’s not bug just improve
I have to rollback to 4.3.4 at the moment .
another problem :
the editor camera can not show the 2d collider in same case .or it’s far away from the base object .
I searched for other people’s posts first, must’ve missed yours.
Yep, totally bunked up things for me.
My solution was to create a parent object that has the collider on it, and rotate the child, put animations on the child, etc. Completely annoying. Waiting on a response as to whether this is new-normal-behavior or new-incorrect-behavior so I can change everything or not.
Okay, so it’s not just me. I’ll try to the parent gameobject with the collider and rotate the child. This has borked my project pretty hardcore, but I want to know if it’s “by design” (thus making it necessary for me to redo my whole project), or “oopsie! sorry for that” and get fixed in a hurry…
This was an intended change that was requested many times however, in hindsight it may be better to provide a rotation on X/Y as an option in 2D physics settings. It’d be possible to get that out in a fairly short duration, maybe as a patch release.
To be clear however, you guys are talking about only transforming the centroid of the collider only and not transforming the collider vertex right?
I’m not doing any vertex transformations.
As stated in the other post all i do is add a collider2D to a 3D object with a rigidbody2D and then rotate the object’s transform to fix the facing direction of the model.
I understand what you are doing but it seems you understood my question. My question was to confirm that you/others only want the centroid of the collider to be transformed and not the the vertex of the colliders (box/edge/polygon). In a simple case (yours) where you rotate around X/Y on the GO that contains the collider in question then the centroid doesn’t move however this isn’t the case when rotating about X/Y in the parent hierarchy.
In 4.5, not only is the centroid of the collider rotated but also the vertex of the edge and box/polygon.
Err… Centroid is a new word to me, so I may be incorrect in my statements but…
Yes, an option for the X/Y rotation to only affect the centroid (center/pivot?) and not the vertex/edges would be nice. However… considering Box2D was originally implemented on solely the Z-plane… I now see that allowing this would (or could) allow you to have X/Z as the ‘overhead’ for a game, rather than X/Y.
Considering Box2D was implemented as such in 4.something-or-other to be X/Y only, we of course built our games to accomodate. It would be nice to simply have a checkbox in the project physics2D section to restrict vertex rotations for X, Y and Z… as I could see similiar issues with an X/Z overhead, rotating Z, and everything being wonky.
I will happily wait for this option to be implemented in a patch release. Kind of stinks that existing projects basically broke due to this as it was working with the current implementation of Box2D. Just, err… not a criticism, more of a want… considering lots of existing projects broke… a patch release would be the most ideal situation.
Yes, I’d like an option to have it only rotate on the centroid of collider, and not reshape the collider’s vertices. (Like it did in 4.3). I want to be able to use 3d models in a 2d game, purchasing them out of the asset store and plopping them in and not worrying about learning how to use blender right now. One thing at a time. The concept of my game would be to difficult for a player to play in 3d, so I need it in 2d, and I really like the 3d models I’ve purchased for it.