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
- Red spots appear when Blending Lighting Scenarios using Adaptive Probe Volumes
- [Windows] About Unity Window needs to be opened twice to adapt to resolution
- NullReferenceException and temporary graph corruption after entering playmode if output node connection was changed
- Sprite Renderer with Animation does not reflect Sprite changes in the Scene when switching Mask Interaction
- User is redirected to a non-existing online documentation link when clicking on "?" help button inside Inspector window while Animator Override Controller is selected
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.