Search Issue Tracker
Fixed in 2021.2.X
Fixed in 2020.3.X, 2021.1.X
Votes
1
Found in
2018.4
2019.4
2019.4.19f1
2020.3
2021.1
2021.2
Issue ID
1334367
Regression
No
RaycastHit2D Normal is incorrect when Physics2D.Raycast hits an EdgeCollider2D with a Rigidbody
How to reproduce:
1. Open the attached project "RaycastNormals.zip"
2. Open SampleScene
3. Enable Gizmos in the Game View
4. Click Play
5. Observe the drawn Raycast and its normal
6. Add a Rigidbody2D to the Edge Collider game object
7. Observe the drawn Raycast and its normal
Expected result: The normal does not change
Actual result: The normal points up, regardless of the edge collider rotation
Reproducible with: 2018.4.34f1, 2019.4.26f1, 2020.3.9f1, 2021.1.8f1, 2021.2.0a17
Workaround: Calculate the normals manually by using RaycastHit2D.collider.transform or use a small Edge Radius on the Edge Collider
Notes:
1. This does not reproduce with other 2D colliders
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
- Crash on GizmoDrawingPhysics2D::DrawCompositeCollider2DGizmo when opening a Scene that has corrupted GameObjects with Tilemap Components
- Scrolling vertically and horizontally is very fast when in Play Mode and RuntimeInputBackend is set to UIToolkitInputBackendOption.Default
- Crash on MemoryProfiler::UnregisterAllocation when initializing entities and leaving Play Mode with Occlusion Culling enabled
- Crash on mdb_page_alloc when opening a project that was running while the PC shut down
- macOS Player freeze when using RunInBackground and Command+Tabbing to and from the application
Resolution Note (fix version 2021.2):
This has been fixed in Unity 2021.2.0a20 and 2021.1.11f1.