Home > Net >  Why the Walk state HumanoindWalk animation start after 5 seconds even a bit more then 5?
Why the Walk state HumanoindWalk animation start after 5 seconds even a bit more then 5?

Time:06-16

I added a new parameter name Walk type trigger.

The state and parameters

And a screenshot of the transition :

Transition

And the code in the Update :

private void Update()
    {
        if (startRotating)
        {
            if (rotateTowards)
            {
                if (rotateTowardsObject)
                {
                    anim.SetTrigger("Walk");

                    Vector3 targetDirection = objectToRotatetowards.position - transform.position;
                    float singleStep = rotationSpeed * Time.deltaTime;
                    Vector3 newDirection = Vector3.RotateTowards(transform.forward, targetDirection, singleStep, 0.0f);
                    transform.rotation = Quaternion.LookRotation(newDirection);
                }
             }
          }
     }

The rotation start once the flag rotateTowardsObject is true but the "Walk" state animation taking 5 seconds even a bit more to start.

CodePudding user response:

On your transition, you should uncheck Has Exit Time

Keeping this checked makes the animator wait until end of your transitioning animation.

  • Related