checkCollisions on mesh controlled by bone

I have a door (simple box mesh) external mesh loaded up and is controlled by bone animations. Add checkCollisions on mesh and it works BUT! the player character gets stuck on the door when a collision happens.

Has anyone had this issue and know of a good fix?

Playing with the collider’s ellipsoid

mesh.checkCollisions = true;
mesh.ellipsoid = new BABYLON.Vector3(0.35, 1.0, 0.25);
mesh.ellipsoidOffset= new BABYLON.Vector3(0, 0.2, 0);

Thanks for the replay
YES the player has the ellipsoid it is only the Door that the player gets stuck in that has the animation attached to it, so the frame of the door witch isn’t animated the player doesn’t stick to it on collision.

Can you reproduce an example in a PG?
It will be easier to help.

The animation is carried out on the GPU, so on the CPU, the door mesh keeps the same transformations when using a skeletal-animation. You could instead attach a box to the bone using attachToBone or manually by getting the bone rotation and position. Then enable collisions on this box.

Yes, if you can edit the door, then place the origin in the vertical center of where the hinge would be. In Blender, for instance:

  • Go into edit mode, selection mode being edges
  • Select the edge where 2 hinge pieces would meet
  • Move the 3D cursor with Shift-s, then ‘t’ for Cursor to Selected
  • Go back to Object mode
  • Select ‘Set Origin->Origin to 3D Cursor’ off of the right click menu.
  • Delete the Armature modifier.

Now a very simple rotation animation will do the very same thing. The Blender description should be very similar in other editors.

If I understand correctly it is the bone animation or meshes attached to a bone that will make the collision overlap and the player will get stuck inside the door mesh.

I am going to look into normals could this be a reason for the sticky collision?

don’t know how easy it would be to reproduces this due to the way a scene is created using Database.

When bones are used, the meshes translation, rotation, and scale remain unchanged on the cpu, since it is performed on the gpu. I do not know a lot about physics, but anything computed on the cpu off of these properties, e.g. bounding box, are going to have the same result as if the door mesh had never been open.

Normals are correct and facing outwards like one would think.

To test this is an effect of using a bone animation, you can force the deformation to be done one the cpu by some like this:

doorMesh.computeBonesUsingShaders = true;

Will not be as fast, but it probably is only a one bone skeleton.

1 Like

computeBonesUsingShaders didn’t work

WASD spacebar

Well you now have published running code anyway. One thing I noticed is an error in the console in the success callback for the importing of door.glb.

I looked at one file,, but did not see where setting the mesh property there. The door did not animate at all. Might be related to the load error.

The door will not animate unless you are facing it and press the spacebar.

computeBonesUsingShaders is added to the meshes when I load the external file door

I don’t get the error you are getting.