0
\$\begingroup\$

I added a death animation among some other things in case of death. But after playing it the player is airborne, so I might need to change the pivot. But I'm wondering if this can't be done with some code

The player's death is then handled by this code:

private void Die()
    {
        Debug.Log(gameObject.name + " died.");
        isDead = true;
        isRegenerating = false;
        //gameObject.SetActive(false);
        player.AnimController.SetDeathState();
        WorldController.Instance.isGameOver = true;
        if (WorldController.Instance.ghostModerEnabled)
        {
            WorldController.Instance.isGhostMode = true;
        }
        //Destroy(gameObject);
    }

enter image description here

I originally thought it might be enough to manipulate the collider on the player to lay down along with the animation so the player stays lying in the air, but that doesn't really work

Edit: 0

The collider in the event of death does not exactly match the position of the player's body. Overall, it looks like this.

The player's character is made up of an empty object containing the character model from the mixamo. All scripts and the capsule collider broadcast on the empty object presenting the player. I know the colliders should look different. But it's something I haven't addressed yet. In case of death, the capsule collider stays in its original position. I tried applying the collider to the character model as well, but the situation is basically the same.

enter image description here

enter image description here

enter image description here

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Generally the collider(s) needs to match the character's pose. Please show what your collider(s) look like in the scene view and inspector. \$\endgroup\$
    – Kevin
    Commented Jun 6 at 17:28
  • \$\begingroup\$ @Kevin Yeah, that's the problem, the collider doesn't adjust to the position of the body in case of death, I've edited the post for additional info \$\endgroup\$ Commented Jun 6 at 19:17

1 Answer 1

0
\$\begingroup\$

I think the problem is because you set the freeze rotation to true

If it does not work try changing the colider (in the code) before playing the death animation.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .