I've been having a hell of a time getting my enemies to go ragdoll on hit. I've messed with all of the settings to make the ragdolls more stable, since I know Unity 5 made changes that caused ragdolls to not behave as stable as in other versions.
I noticed something interesting today, I used the debug.break() function when I hit the enemy, to see precisely what was happening in that frame. I noticed that the enemy character moves into the floor when it is hit. I'm using a mechanim character and this is the simple function I'm calling when the enemy is being hit:
public void KillRagdoll ()
{
foreach (Rigidbody ragdoll in bones)
{
ragdoll.isKinematic = false;
ragdoll.velocity = Vector3.zero;
// sets the tag of the bone objects once the player has died
ragdoll.gameObject.tag = "DeadBody";
}
anim.enabled = false;
}
Where anim is the animator for the game object. I don't see why any of this would cause the character to move down into the floor when the anim is disabled.
Any help is GREATLY appreciated, been working on fixing this for weeks now.
Thank You :D
↧