Can bounding box work as a colliision system?

I saw some example of using moveWithCollisions() but it’s extended with bounding boxes there: https://playground.babylonjs.com/#ZGVPLS#26

I have some questions on that:

  1. To my mind, Gizmos it’s some sort of debug visual information but looks in that example bounding box can handle and check collisions? Is it ok to use such system with boundingBox collisions in a production mode?

  2. The example contains a line:

var bb = BABYLON.BoundingBoxGizmo.MakeNotPickableAndWrapInBoundingBox(avatar1);

but what if we need to pick those player objects in our game? How to get it? How to just wrap in BB but not make it notPickable?

  1. By the way, if we show bounding boxes then we see that there some space left between objects. Modified PG (added showBoundingBox=true): https://playground.babylonjs.com/#ZGVPLS#31
  1. here you are not using Gizmos but a helper mostly used with them so it is fine but it might have to many limitations for your case.
  2. you would need to rebuild what the function does internally, basically parenting all the element to a parent simple mesh used to “hijack” picking preventing expensive raycast on complex mesh. It helps a bit with moveWithCollision as you could also use it as the main collider for the other object.
  3. moveWithCollision relies on ellipsoid and ellipsoidOffset of the mesh to detect collision with the other meshes: Babylon.js docs.
1 Like