Search Issue Tracker
By Design
Votes
0
Found in
2018.4
2019.4
2019.4.11f1
2020.2
2020.3
2021.1
2021.2
Issue ID
1312802
Regression
No
Physics2D - CircleCast hit point is different than Raycast from the same origin point
Reproduction steps:
1. Open user's project "circlecast_issue.zip"
2. Open "SampleScene" Scene
3. Enter Play Mode
4. Press the space bar
5. Observe the Console
Expected result: CircleCast hit point has the same coordinates as Raycast hit point
Actual result: CircleCast registers collision with the Box Collider 2D 0.0025 points nearer than Raycast does (4.9975 and 5)
Reproducible with: 2018.4.32f1, 2019.4.22f1, 2020.2.7f1, 2020.3.0f1, 2021.1.0b10, 2021.2.0a8
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
- Tags window completely breaks and throws Exception errors when Adding a Tag to a GameObject
- Crash on BurstCompilerService::CompileAsync when entering Play mode in a specific scene
- InvalidOperationException when using Game Camera Preview in Scene window with a custom RenderGraph pass
- Changing "PreWarm" parameters on VFX Graph leads to significant performance drops and freeze due to rapid changes in "Total Time"
- Player display resolution changes to the native resolution of the monitor when Player becomes unresponsive
Resolution Note:
Raycasts are not used by the physics system at all, only by end users and are a pure geometric intersection test. All other queries such as shape overlap/casts use functions that the physics system uses and so give results based upon where they would actually contact which isn't idential to a real intersection. This takes into account things like the contact offset etc. (https://docs.unity3d.com/ScriptReference/Physics2D-defaultContactOffset.html).
A raycast will give you the exact point of intersection but there are no cases in physics where a point moves through the world i.e. there's no point collider.
If the user wants to know where a circle would then they can move back by the radius of the circle but the physics system would also move it further back by the contact offset.
In short:
Raycast = Utility Intersection Test no used by physics so doesn't produce real contacts, just intersection
Shape Overlap/Cast = Real physics contact intersection tests.