Animations and Physics not working. I can't animate my robot and he keeps falling through the floor and walls

Hello Babylon.js Creators

I really need help I’m struggling with animating my robot and when I add physics to him he keeps falling through the floor and walls.

Would anybody please be able to help me get the animations working and maybe the physics too please? I can’t find any documentation on mesh colliders.

Sorry for the tag. I heard from other posts you are a master of physics @Cedric

Hi @Cameron_Pheiffer and welcome to the forum

I did a few changes regarding scaling and parenting

Resly Robot | Babylon.js Playground (babylonjs-playground.com)

The walls are a single mesh. You will need to split it in 4 parts with a box impostor for each one or the wall box impostor will contain everything.

Hi, @Cedric thank you so much you are a life saver.

Playground:

I flipped the robot just upright and it seems the collider is underneath. How would I be able to put the collider around the robot so that the robot is properly on the floor?

I also wanted to ask for some reason I am only able to animate my robot on my forward function but I can’t execute any of my animations on my backward function, and turning functions.

Do I need to change anything to be able to execute the other animations or what would you suggest?

Rotation is fixed when done after creating impostor:

Resly Robot | Babylon.js Playground (babylonjs-playground.com)

I would not use animation with physics, I would apply forces/torque instead to the impostor.

Just to ask would you be able to play an animation while adding torque/forces to the imposter so that it looks like the robot is moving and animating?

The issue with animation here is it’s looping so robot will get back to its position after playing the animation.
It might be possible to use additive animation but I didn’t test it, even less with physics: Advanced Animation Methods | Babylon.js Documentation
Depending on your use case, you may want to use physics solver to animate the root of the robot and use animations for the child transforms.