Enemy dies floating because of the collider

![Whenever the enemy dies he plays the death animation, the problem is when he dies and lays on the ground, he is floating and that is because of the capsule collider attached to him. How can I move the collider with him and not make him float on the ground anymore? I want the collider to move with the mesh. I don’t want to use the mesh collider.

Here is an Image that shows the player ][1]

Try changing the direction of the collider to the Z axis on death: Unity - Scripting API: CapsuleCollider

Something like:

void die(){
  Collider collider = gameObject.GetComponent<Collider>();
  collider.direction = 2;
}