Search Issue Tracker
Fixed in 2021.2.X
Fixed in 2021.1.X
Votes
3
Found in
2019.4
2020.1.6f1
2021.1
Issue ID
1287916
Regression
No
ContactPoint2D.tangentImpulse sometimes returns NaN when called in OnCollisionEnter2D
How to reproduce:
1. Open the attached "case_1287916-Project" project's Scene labeled "Main"
2. Enter the Play Mode
3. Get the "Player" near to the ground
4. Flip it on the side using the "Right-Arrow" key
5. Hold "Left-Arrow" to put the Player in the upright position
6. Flip the "Player" again on the side (Space+Right-Arrow)
7. Repeat from the 5th step (2-5 tries)
8. Inspect the Console Window
Expected result: ContactPoint2D.tangentImpulse doesn't return NaN when called in OnCollisionEnter2D
Actual result: ContactPoint2D.tangentImpulse sometimes returns NaN when called in OnCollisionEnter2D
Reproducible with: 2019.4.13f1, 2020.1.13f1, 2020.2.0b11, 2021.1.0a5
Couldn't test with: 2018.4.29f1 (Project breaks)
Comments (1)
-
Menion-Leah
Nov 05, 2020 12:32
Same issue here (also in Unity 2018.x).
As I side note, I discovered that in my case this behavior happens more often when I check for secondary impact points (IE: second, third, fourth.. collision points in the Collision2D.contacts array).
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
- var VisionOSEDRHeadromm has a comma instead of a dot when building with Metal Rendering App Mode and local OS localization is set to German
- IAP Catalog remove product “x” and add product “+” buttons are not consistent with other remove and add buttons in the Editor
- Performance issues in Play Mode when quickly hovering the mouse cursor over Hierarchy GameObjects
- Frame Debugger displays incorrect output when FidelityFX Super Resolution or Spatial-Temporal Upscaler is used with Temporal Anti-aliasing or Subpixel Morphological Anti-aliasing
- The layout system is failing to correctly calculate or apply the height of the Japanese fallback font when the primary English font's metrics are used
Resolution Note (fix version 2021.2):
Fixed an issue where the contact manifold count would transition from 1 to 2 during the pre/post solve cycle. This resulted in normal/tangent impulses not being reset correctly and therefore the subsequent sum of impulses being undefined leading to bad values or NaNs being reported. Now the impulses are reset regardless of contact count. Fixed in Unity 2021.2.0a11 and above.
Ref: https://forum.unity.com/threads/possible-unity-bug-contact-normal-is-nan-in-oncollisionenter.276770/#post-6901259