Home > Net >  When i add rigidbody, animation makes player float. In Unity
When i add rigidbody, animation makes player float. In Unity

Time:11-29

I am trying to play the animation but whenever i add rigidbody, player starts to float in the air at the constant value (which is 3.5 Y). No script is attachted atm.enter image description here

I tried to remove rigidbody which solved the problem, but i need it so deleting rb is not an option. Gravity values are normal and the other animations are from mixamo (i didn't do the animations).

CodePudding user response:

Based on the information provided here is what I'm thinking:

The root cause of this is that your character model when effected by gravity is being pushed to the ground and foot IK is causing the legs to end up looking like your screenshot above.

Some common approaches to this problem:

  1. Create an empty object called player (Controls Rigidbody/Capsule Collider/Character Logic)
  2. Add the 3d Model as a child of this object (Animator/Mesh/etc).
  3. On the root object add your rigidbody as well as a capsule collider (prevents character model from colliding with the environment due to gravity).

With this setup animations can be done on the model ( foot IK) without gravity causing issues.

CodePudding user response:

Okay i just solved the problem. Problem was neither rigidbody nor animation. The collider of mesh (ground) has option checked "is Convex". I turned it off, problem solved, player is not floating anymore.

  • Related