Collider cast instead of simple raycast

Hi! I’m currently facing an issue for my game.

I need to preview the trajectory of my mesh (sphere) and check if it will collide with another object. I can’t use a simple raycast to check because, as the name suggest, it’s a simple ray.

For example, a ray won’t hit an object but a ray with the shape of a sphere will, due to its attributes(width, height, shape).

Unless I’m wrong, I don’t find any cast object in the library (cubeCast,SphereCast, etc) like Unity and Unreal. I can only find the simple ray.

Am I missing it or is there a way to counter my issue?

Thanks!

cc @Cedric in case it’s something we already have or which would be planned for Physics v2.

It’s not something planned for the release but I can start looking at what is possible.

2 Likes

Hi.

I’m reviving this old question.
Any plan to have a spherecast (i think it’s the simpliest) with physics v2?

Actually i « emulate » it with 10 ray casts but it’s not accurate with distance increasing.

Shape cast is now part of Physics v2.
No documentation yet but there are some PG that might help you in the PR : Point Proximity, Shape Proximity and Shape Cast in Havok by carolhmj · Pull Request #14736 · BabylonJS/Babylon.js · GitHub

1 Like