In the same environment.,the blue box shifts upward while moving forward, and the yellow box stops when it reaches the edge of the ground

In the same environment.,the blue box shifts upward while moving forward, and the yellow box stops when it reaches the edge of the ground
Babylon.js Playground - #BZ92LQ

moveWithCollisions() uses an ellipsoid for collision detection. I think that the default ellipsoid doesn’t match the box size, It’s strange because they should act the same.

Try this setting:

box.ellipsoid = new BABYLON.Vector3(0.5, 0.5, 0.5);
box2.ellipsoid = new BABYLON.Vector3(0.5, 0.5, 0.5);

box.showBoundingBox = true;
box2.showBoundingBox = true;

fixes the collision shape. Also, enablePhysics() can be removed since moveWithCollisions() does not use the physics engine.