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
- [URP] Crash on GameObject::QueryComponentByType when baking a Reflection Probe in an unsaved/untitled Scene
- No Icons are used for the Entry and Exit States in the Inspector when selected in an Animator Controller
- Crash on PlayerMain(int, char const**) when exiting Standalone Player with a Particle System in the Scene
- No Icon is used for the Runtime Animator Controller Type in a Search Window when assigning an Animator Controller in the Animator Component
- Unity Version Control server textfield’s text overlaps with the dropdown triangle button in the Explore repositories window when an organization with a long name is selected
Add comment