x


Animation - Normalized Time not Reaching 1.0

I'm having some trouble with an animation. The normalized time never reaches 1.0, and the animation constantly repeats, even though it's wrap mode is WrapMode.Once.

I've posted a video that explains the issue in more detail : http://www.youtube.com/watch?v=I4WQdjMWo5Q&feature=youtu.be

Here's part of the script that plays the animation:

public void Crouching(){

    // Do the crouch
    if (Input.GetButton("Crouch")){


       // TODO: HACK!!!
       if (animation["Crouching_m"].normalizedTime < 0.8f){
         animation["Crouching_m"].speed = 1;
         animation.CrossFade("Crouching_m");

       }
       else{
         //animation.Stop("Crouching_m");
         animation["Crouching_m"].speed = 0f;
         animation.CrossFade("Crouching_m");
       } 

    }
    else{
       animation["Crouching_m"].speed = -1;
       if (animation["Crouching_m"].normalizedTime > 0.0f){
         animation.CrossFade("Crouching_m");
       }
    }

    // Switch back if the animation is finished
    if (animation["Crouching_m"].speed < 0 && 
       animation["Crouching_m"].time <= 0){
       SwitchState(EntityState.GROUNDED);
    }

}
more ▼

asked Mar 28 '12 at 12:12 AM

JvJ gravatar image

JvJ
16 1 1 2

Found a solution for this? I have the same issue.

Apr 30 at 08:11 AM Vicas

"If the animation is not set to be looping it will be stopped and rewinded after playing." A quote from the documentation on CrossFade. This should answer you question

Apr 30 at 09:25 AM Benproductions1
(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3772
x13

asked: Mar 28 '12 at 12:12 AM

Seen: 607 times

Last Updated: Apr 30 at 09:25 AM