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
- Articulation Body with 'Revolute' Joint Type has erratic behavior when Upper Limit is set to above 360
- WebGL Player fails to render Scene when Terrain with Detail Mesh is added and WebGPU Graphics API is used
- Inconsistent errors are logged when different types are passed into the Query "Q<>" method in UIToolkit and the ancestor VisualElement is null
- Crash on GetMaterialPropertyByIndex when opening a specific Scene
- Discrepancies in the styling are present when using a TSS file instead of a USS file in custom EditorWindow
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