Search Issue Tracker
By Design
Votes
7
Found in
2019.4
2020.3
2020.3.24f1
2021.2
2022.1
2022.2
Issue ID
1403474
Regression
No
Inconsistent ContactPoint placement when using OnCollisionEnter
1. Open project "PhysicsBugs.zip"
2. Enter Play Mode
3. Press the spacebar and observe the view
Expected result: Contact points are in the same position every time
Actual result: Contact points are in the different positions
Reproducible with: 2019.4.36f1, 2020.3.30f1, 2021.2.14f1, 2022.1.0b10, 2022.2.0a6
Note: Reproducible in the Editor and in the Player
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
- [HDRP] HDRP Look Dev has no button leading to the documentation
- [Android] Artifacts appear when instantiating a prefab on a PowerVR Rogue GPU device
- Skinned Mesh Renderer with enabled 'Skinned Motion Vectors' flickers when Ray Tracing with Screen Space Global Illumination is used
- [HDRP] "Show on start" checkbox is too close to the window border and is not aligned with the other elements
- RenderGraph shows incorrect values for some Depth Attachment Format and Depth Texture Format options
Resolution Note:
This behaviour is internal to the physics engine. Basically, there is a table of functions that generate pairs for shapes of given types: sphere vs box, box vs capsule, etc. This table is not symmetric: if it has an entry for table[x][y], it won't have an entry for table[y][x]. Because of that, when computing the contact points, the physics engine sorts shape types in a pair according to the value in the appropriate enum. Then, this new shape pair is used to fetch the matching contact computation function from the table, so that is what I believe will make it relate to one or the other shape.
Reference:
[1] PxGeometry enum values: (https://github.com/NVIDIAGameWorks/PhysX/blob/c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa/physx/include/geometry/PxGeometry.h#L53)
[2] Check if a swap is required: https://github.com/NVIDIAGameWorks/PhysX/blob/c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp#L325
[3] Pick the contact generation function: https://github.com/NVIDIAGameWorks/PhysX/blob/c3d5537bdebd6f5cd82fcaf87474b838fe6fd5fa/physx/source/lowlevel/common/src/pipeline/PxcNpBatch.cpp#L381