Scene.PickWithRay VS Physics.Raycast

Yo @Deltakosh , @sebavan , @Cedric … I got a question about pick with ray vs an actual physics raycast… Well basically is there a performance issue with one vs the other ?

Should i use physics over scene pick with ray ?

I am basically making a player controller that support both mesh.moveWithCollision as well as Ammo.btKenematicCharacterController movement. Right now i use scene.pickWithRay downwards to detect grounding… I use that for both setups. Should i be using Ammo physics raycast when using the character controller, is that physics raycast more performant in the long run ?

2 Likes

Unless you use Babylon’s Octree or roll your own spatial partitioning, Ammo will be faster, as identifies possible intersections by first traversing the broadphase, followed by the more expensive ray/face test.

2 Likes

@sebavan and @Cedric are both out on vacation right now. Maybe @RaananW can confirm.

There is no real need to turn on both collision-system and a physics engine.
Ammo will probably be faster, as @Ragger said. It very much depends on your scene setup, but if you already require a physics engine, use it :slight_smile:

1 Like