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
- SearchExpression strips quotes
- dSYM file is not created during macOS standalone build
- Project Settings panels disappear and do not repaint when entering Play Mode without reloading Domain
- Screen Space Decals ignore Rendering Layer Mask when using OpenGL Graphics API
- Crash on scripting_method_invoke when the Player is build before entering the Play mode in the Editor
Add comment