Unity: Character model falls over when animated

Date: 2020-04-13 | unity | model | 3d | troubleshoot | rigidbody |

problem

I like building projects. My newest project is a 3d endless runner game built in Unity. While I was building this I ran into a problem where my character model would fall over like a ragdoll whenever I triggered an animation.

I have "ground" that consists of objects with mesh colliders and my character model has a capsule collider and rigidbody (for physics animation).

solution

It turns out that the Rigidbody was causing the character to fall over - likely due to the friction between it and the ground and no constraint to keep it upright.

To keep my character from falling over, I:

  • Selected my character model
  • Found the Rigidbody attached to it
  • Expanded the Constraints section
  • Selected the Freeze Rotation checkboxes next to x, y, and z

Now this works for me because my endless runner game doesn't require rotations of any kind. Your program might be different so selecting each axis will tell the rigid body not to rotate in that direction.

Happy coding

-HAMY.OUT

Want more like this?

The best / easiest way to support my work is by subscribing for future updates and sharing with your network.