I am trying to make a 3D game with Babylonjs, and I am currently working on enemies’ movements and physic. I struggle to use the moveWithCollision method on my “avatar” class, extending the Mesh class.
Setting the avatar’s physic with an Ellipsoid doesn’t seem to work as no collisions are detected and avatars go through each other. If I try to set the checkCollisions attribute of a sub mesh to true instead, the avatar doesn’t follow the direction given at all.
Here’s a playground that sums up my problem:
How should I proceed so my avatars work with collisions and all related things and move as expected with the moveWithCollisions method?
The avatar does not have geometry information and is skipped by the collision detection. The solution proposed by @carolhmj is the best one: create geometry (boundingBox geometry) and move it.
This way, the other avatar is properly tested against the ellipsoid.
What is BoundingBoxGizmo there? I thought the gizmos is something like visual debug lines, but it looks that I don’t see any gizmos there
Why does gizmos can handle collisions? It’s hard to understand for me
So that Gizmo creates a collider (actually bounding box) for a Mesh?
Why do we do those meshes not pickable? What if we need to pick that avatar mesh?