Animated character and built-in collision detection

Hello fellow Babylonians!

I am a beginner to 3D game development and babylon.js.

I am trying to build a scenario-based 3D learning space where avatars can navigate around and do stuff.

To support collisions, I have tried a couple physics engines but they seem too complicated for my use case. So I selected the included collision engine of babylon.js and it seems to be working nicely except when the avatar is animating.

In an animation I found online, the avatar seems to translated a few “centimeters” off the original center of the meshes, to one side. When colliding with solid boxes, it seems that the collisions happen with the original avatar and not the animated one, which makes, for example, entering doors very weird.

I read the documentation on mesh collisions but there are very few details on what is actually happening when moving with collisions. For instance, is the bounding box used or the ellipsoid?

I have made the following playground, where the weird behaviour can be observed both when entering into the room and especially on a single side of the grass box, where the model cannot approach as close as with the other sides. Please excuse me for the keyboard movement:

Can you help me resolve this?

@Cedric would be a good person to help here.

Hi @Lazaros_Ioannidis

The collision system uses an ellipsoid to do collision detection (and movement response).
The mesh responsible for collision must not be parented or you will get undefined behavior. The parent will always have the priority on the children and collision detection on children will not be taken into account.
For best results, ellipsoid and ellipsoid offset should not change.
Make sure your mesh is centered on the bounding box center, so the ellipsoid will also be centered properly.
Withi these 3 constraints applied, you should get better collision results.