Dead characters glitching out after "navMeshAgent.enabled = !health.IsDead();"

After implementing the last line of code in the video, “navMeshAgent.enabled = !health.IsDead()”, the characters are behaving strangely after they die. If the player kills the enemy, the enemy T-Poses and slightly rotates along the ground. And when the enemies kill the player, the player seems to fall through the Nav Mesh, and can no longer be seen on the ground in front of the enemies. I even copied over the mover.cs code from this lecture’s GitHub Commit, but I’m still having the same issue. Any advice anyone has to offer would be appreciated. Thank you.

If you have a Rigidbody on the player or the enemies, be sure to check the isKinematic checkbox and uncheck the use Gravity checkbox. This should fix both the player dropping through the scene and the odd physics rotation when the enemies die.

I’m not sure what’s going on with the enemy T-posing… usually that’s because the animator doesn’t have the correct Avatar set, or perhaps the Death animation isn’t set up/imported correctly.

I’m not sure what was happening there either, but whatever it was, checking/unchecking those boxes fixed both problems. Thank you so much for your help, @Brian_Trotter !

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms