- Home /
Latest 5.2.2p3 Patch Breaks 2D Collision?
I just updated to the latest patch 5.2.2p3 and now hardly any 2D colliders are triggering. I would say only about 10% off OnCollisionEnter2D events are triggering.
The collision is happening -- as the physics engine is still bouncing the objects off of each other -- but the event OnCollisionEnter2D is no longer firing.
I've not made any code changes -- just installed the latest patch and try to run my game in the Editor.
This happening for anyone else?
Manny
I found a workaround: Add a "Rigidbody2D" component to your object and set it as "is $$anonymous$$inematic".. done!
I am not really sure what the workaround is really supposed to accomplish. Unity broke it, and in fact It has been broke since at least 5.2.2p3 (I did not check 5.2.2p2). $$anonymous$$y object already has a Rigidbody2D, which I require it to be non-kinematic, and it is no longer triggering OnCollisionEnter2D unless under low velocity. This is a definite bug and should be fixed asap !
I noticed a similar Physics/collision 2D issues in the 5.2.2p3 patch. I tried changing objects to "is $$anonymous$$inematic", working with Physic2D materials, etc, all to no avail.
The issue I have is that all my colliders still detect events, but the colliders never bounce on collision. I think this is related to your problem.
Anyone else have this issue?
Answer by MelvMay · Nov 25, 2015 at 07:49 AM
I've already acknowledged this issue several times on forums and once on twitter and this is the first I've seen this thread so please be patient. Posting on forums is much more likely to get a response than here which is harder to track.
This issue was fixed a while ago and has been ready in the latest patch waiting for release in 5.2.3p1 that is, I believe, due out for release today (25th Nov 2015).
The problem is with collision-reporting when a Rigidbody2D using continuous collision detection, both enters and completely exits a contact during a single physics update.
Sorry for the problem but a fix was issued on the same day it was reported. It's just that there's a week or so delay before a patch gets out.
Thanks for the update, very happy this is being resolved! :-)
You're most welcome, sorry for the problem.
I'm amazed this one slipped out TBH. Existing unit-test coverage didn't detect it so alongside the fix was a new test that does indeed detect it.
Answer by Derf321 · Nov 22, 2015 at 06:54 PM
Still present in 5.2.3f1. Please upvote the issue here: http://issuetracker.unity3d.com/issues/continuouscollisiondetection-if-multiple-collisions-happen-in-one-update-oncollisionenter2d-is-only-called-for-the-last-one
Answer by Nicolas1212 · Nov 10, 2015 at 05:35 PM
Same here - I get the collision callbacks if the objects collide at a very slow velocity.
Looking at the patch notes, it's possibly this:
(719418) - Physics: Physics2D, Collider2D & Rigidbody2D IsTouching and IsTouchingLayers now correctly represents Box2D contact state.
If I was to guess, I'd say the collision callbacks are only being called if your objects happen to be touching on the frame itself (hence why it works when the objects have a low velocity), so if there's a collision between frames, they're not triggered
Add a "Rigidbody2D" component to your object and set it as "is $$anonymous$$inematic".. done!
I've filed a bug which has been merged into an existing one - basically you'll have this problem if one of your Rigidbody's is set to Continuous collision detection. A workaround is to switch to Discrete.
@$$anonymous$$arcelo - thanks for the tip, but marking something as is$$anonymous$$inematic means that we have to move the object manually etc.
Answer by manny003 · Nov 16, 2015 at 04:15 PM
Update: Just updated to patch 5.2.2p4 -- STILL BROKEN.
Since I am a rookie, I rushed to respond. To clarify: prior to the problem I did not have a Rigidbody2D attached to the object, when I add it, it solves the problem (the fact that it is $$anonymous$$inematic or not, is irrelevant to the collision). Something I've noticed is that you use "OnCollisionEnter2D"... and in my case I use "OnTriggerEnter2D"
Answer by $$anonymous$$ · Nov 21, 2015 at 12:32 AM
I am having the same issue... just upgraded from 5.1 to 5.2.2p4. Was going to try 5.2.3 but as mentioned above by @densy07 looks like it's not fixed in that.
I have two objects, both with RigidBody2D and colliders. One is set to kinematic and discrete collisions. The other is not kinematic but has continuous collisions.
This worked perfectly in 5.1. Now I am finding that OnCollisionEnter2D is called 90% of the time. The times it is not called, the two objects are moving past each other quickly, they bounce off each other but the event is not fired.
The problem is fixed if I change the object with continuous collisions to discrete collisions. However that causes problems with the accuracy of other collisions in our game so not a solution for us.
Hopefully this will be fixed in the next patch :(