Search Issue Tracker
Won't Fix
Votes
1
Found in
2021.3.25f1
2022.3.0f1
2023.1.0b18
2023.2.0a16
Issue ID
UUM-41517
Regression
No
Physics.Raycast fails to detect collisions when Navmesh Agent's position is set to NaN
How to reproduce:
1. Open the user’s attached project “Bug Test.zip”
2. Build And Run
Expected result: Raycast detects collision by turning the “Sphere” GameObjects green
Actual result: Raycast does not detect collision by turning the “Sphere” GameObjects red
Reproducible with: 1.0.0-exp.4 (2021.3.25f1), 1.1.3 (2022.3.0f1, 2023.1.0b18, 2023.2.0a16)
Could not test with: 2020.3.47f1 (IL2CPP exception error when trying to build)
Reproduced on: Windows 10
Notes:
- Not reproducible when removing the Vector3.one division by 0 in "Test.cs"
- Issue reproduces only with a Navmesh Agent present in the project
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
- "Customize handled extensions" part in the External Tools settings tab is not aligned with other properties
- Editor Diagnostics foldouts do not open when clicked on the foldout title
- [UI Builder] Visual Elements are not placed at the mouse cursor position when Absolute Position Placement is enabled
- "Width" and "Height" text is misaligned with slider ends in Screen Match Mode Parameters section of Panel Settings Asset
- Editor does not quit when Editor is not in focus and any floating window is opened
Resolution Note:
Up on closer examination, we have to conclude that deliberately putting objects to NaN, infinity, or very large positions is not exactly supported by the physics engine in use today (PhysX). In the current versions, it's known to cause hits missed because of the issues arising in the spatial search trees up on the presence of such objects. It's not something that can be fixed at this moment, unfortunately, and in the newer Unity versions we explicitly disallow setting infinite positions to transforms (there'll be an error and the position will be discarded). We hope that in your particular project there is a way to avoid relying on invalid positions still being somehow processed without artefacts.