Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

I have a question about the function Animation.CrossFade()

Discussion in 'Animation' started by zlbdemon, Apr 27, 2015.

  1. zlbdemon

    zlbdemon

    Joined:
    Jun 3, 2014
    Posts:
    8
    Hi everyone .
    I have two piece of animation clips ,each of them last 1 second.when i use crossfade function to change the animation like this

    GetComponent<Animation>().CrossFade(roll.animation.name);

    if(GetComponent<Animation>()[roll.animation.name].normalizedTime > 0.95f){
    controller.isRoll = false;
    animationState = Run;
    }else{
    controller.isRoll = true;
    }


    this charactor will roll forever.when i change that into

    GetComponent<Animation>().CrossFade(roll.animation.name,0.05f);

    if(GetComponent<Animation>()[roll.animation.name].normalizedTime > 0.95f){
    controller.isRoll = false;
    animationState = Run;
    }else{
    controller.isRoll = true;
    }


    It works well .
    Can anyone tell me the reason? THX.
     
  2. zlbdemon

    zlbdemon

    Joined:
    Jun 3, 2014
    Posts:
    8