Search Issue Tracker
By Design
Votes
0
Found in
4.3.0b3
Issue ID
566533
Regression
No
Incorrect normal is returned in the RaycastHit2D when the fraction is 0
Steps to reproduce :
- import the project attached
- open the ControllerTester scene
- press right to attempt to climb the ramp and notice that the normal is reported as -1,0
Explanation :
Both the line-cast and ray-cast for 2D return colliders that exist at the start of the line/ray. This differs from 3D which doesn't do that.
In the case of something found at fraction=0 i.e. the start of the line/ray, it indicates that the line/ray starts inside a collider. In this case there is no collision normal as the line/ray did not intersect any surface.
Under these circumstances, rather than return a zero collision normal, the collision normal is set to be the opposite of the line/ray vector.
It should be note that the example provided moves the character around by manipulating the transform and bypasses the 2D physics itself. This causes interpenetration. In the example project, if I ignore hits at fraction=0 then the character simply falls through the levels.
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Shader Compilation for projects with lots of Shaders can be slow (i.e. VFX Graph asset heavy projects)
- Crash on RebuildTransformHierarchyOrMarkForDestruction when opening a scene
- The Editor hangs when opening a project that uses local packages and Version Control
- Area Light is culled when Camera Frustrum is outside the lights range
- The characters of the bottom option in the Scene View Debug Draw Mode dropdown menu are cut off
Add comment