When using shapecasts and casting them against inclined surfaces, the RaycastResult.Position
can be way more off than expected. This behavior can cause unwanted effects in character & vehicle controllers.
In the below videos, I am casting a cylinder downwards against a WedgePart, and then against a regular angled part (i dont know if the difference matters). The direction towards the result from the ray’s origin is drawn with a neon thin line for clarity. I’ve also tried the same thing with a cylinder mesh instead of a regular part cylinder, and the behavior is the same.
WedgePart:
Angled regular part:
The effect can be very severe, as RaycastResult.Position
can even be mid-air in a very far position:
It’s worth noting that even when the position is off bounds or mid-air, RaycastResult.Instance
is still accurate.
The script used is located inside ShapecastProjection in workspace.
Reproduction file: shapecast inaccuracy bug reproduction.rbxl (58.1 KB)
Expected behavior
Shapecasts should be accurate and deterministic in all conditions