Add a way to get the central position of the "shape" when a shapecast hits

Currently when using shapecasts it is cumbersome to get the central position of the shape when the ray hits.

Visualiation:
image

This would be especially useful for simulating projectiles that may ricochet/bounce off surfaces (currently I am stuck setting the projectiles new position to the hit point which causes noticable clipping). Adding this as a feature would be greatly appreicated (making RayResult.ShapeCenter == RayResult.Position for oridinary raycasts would be great too).

3 Likes

does RaycastResult.Instance.CFrame not solve this?

Oh I see, misunderstood the request.
I think you could still compute this using the result’s normal and current radius/size of the shapecast?

This would work, but a value within RaycastParams would still be appreicated.

Edit: However this approach doesn’t seem to work for Blockcasts.

The resulting position is based on RaycastResult.Distance.
You can get the final location as originalCFrame + direction.Unit * result.Distance.

Maybe it would make sense for us to add that as a convenience function if folks would find that helpful :slightly_smiling_face:

5 Likes