Search Issue Tracker
By Design
Votes
0
Found in
2018.2.2f1
2018.3.0a5
Issue ID
1071735
Regression
No
RaycastHit.normal ignores Physics.queriesHitBackfaces when Raycasting a line
How to reproduce:
1. Open User Attached project
2. Open "RayScene" Scene
3. Observe the ray casted from the bottom cube
Expected results: casted ray is deflected back when backface is hit
Actual results: casted ray ignores backface
Reproduced: 2017.1.5f1, 2017.2.3p3, 2017.4.9f1, 2018.1.9f1, 2018.2.4f1, 2018.3.0a9
Note1: functions as intended when sphere casting or box casting (check RayCreater Game Object > Ray Test component for comparison)
Note2: ever since 2018.3.0a5, all raycasting methods ignore backface
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
- "Shader warning in 'Hidden/Light2D': implicit truncation of vector type" is thrown when building Universal 2D template
- AI Assistant breaks compilation of packages using System.Runtime.CompilerServices.Unsafe via auto-referencing
- Unity Hub checks the "Documentation" module by default on the 6.4 and 6.5 streams despite that it was unchecked with the previous installs
- Shortcut that toggles between Dopesheet and Curves Views in the Animation Window's Timeline is mislabed
- Property List Items Overlap onto the Property List's top edge when scrolling through a long Property List
Resolution Note:
When a Raycast hits a triangle, it will always return the normal of that triangle and the normal is not dependent on the observer position (i.e. where the ray was launched from), which is why we’re seeing the result that we see. A manual inversion can be applied to the normal if the Raycast angle is below/above a certain threshold.
Regarding Note 1: Not true, one can see where the cast was when it hit, but the normal (blue line) still represents the normal of the hit triangle rather than the direction the triangle was hit from.
Regarding Note 2: Not true using 2018.3.0b4 on macOS. All queries presented in the script correctly hit mesh collider backfaces.