Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4.3f1
2020.2
Issue ID
1263380
Regression
No
OnCollisionExit callback is called when a Rigidbody is still in collision with non-convex mesh collider
How to reproduce:
1. Open the attached "CollisionCounterTest_Reduced.zip" project
2. Open the "SampleScene" Scene
3. Make sure the Console log is visible
4. Enter Play Mode
5. Drag the Gun GameObject( white rectangle) down on the Y Axis so that it collides through the big flat box (with a non-convex mesh collider)
6. Once the rectangle's centre (visualised by a thin ring around the rectangle) passes through the mesh collider, OnCollisionExit will be called
7. Observe the Console log
Expected result: OnCollisionEnter and OnCollisionExit callbacks are called when the "Gun" GameObject has begun/has stopped touching the "Cube" GameObject's Mesh Collider
Actual result: OnCollisionExit callback is called even though the "Gun" GameObject is still inside the "Cube" GameObject's Mesh Collider
Reproducible with: 2018.4.26f1, 2019.4.8f1, 2020.1.2f1, 2020.2.0a20
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Automatic LOD fails and SRP Batcher incompatibility occurs when using spline-based quad-topology meshes
- Editor crashes on D3D12GetInterface when repeatedly enabling and disabling 256 text components
- Flickering bright white dots in the Scene when the Android Platform is selected and DX11 Graphics API is used with Iris(R) Xe Graphics GPU
- Inconsistent capitalization and misaligned text in multiple query blocks in Search window
- “Remove Unused Overrides” available on not loaded Scene and throws “ArgumentException: The scene is not loaded” warning
Resolution Note:
The non-convex mesh collider does not really have a concept of "Inside" and "Outside" of a mesh. You could get the same result with a plane that your object passes through. Once the center of the object is on the other side of the mesh collider, there is nothing to collide with anymore and it reports a lost touch (OnCollisionExit)
We state this in our documentation: "Faces in collision meshes are one-sided. This means GameObjects can pass through them from one direction, but collide with them from the other."
If there is a need to report collisions from the inside of a mesh, then a convex mesh collider should be used.