- Home /
 
               Question by 
               anwe · Jun 22, 2011 at 11:53 AM · 
                animationcrossfadeanimationstate  
              
 
              Problem with animations, How to blend them??
Well, I've got some animation for my chopper, so that it can rotate right, left, forward and back, but when I press the input axes(for example up and left)it only rotates forward instead rotating also to the left Here's my code
 var speedLeftRight : float = 50;
 var speedBackForward : float =50;
 var speedUpDown : float = 10;
 //Uso animationState x effettuare il blending successivo
 private var back : AnimationState;
 private var forward : AnimationState;
 private var left : AnimationState;
 private var right : AnimationState;
 //Settaggio di tutte le variabili e funzioni in partenza
 function Start(){
 animation.Stop();
  
 back = animation["back"];
 forward = animation["forward"];
 left = animation["left"];
 right = animation["right"];
  
 back.blendMode = AnimationBlendMode.Blend;
 forward.blendMode = AnimationBlendMode.Blend;
 left.blendMode = AnimationBlendMode.Blend;
 right.blendMode = AnimationBlendMode.Blend;
  
 back.wrapMode = WrapMode.ClampForever;    
 forward.wrapMode = WrapMode.ClampForever;  
 left.wrapMode = WrapMode.ClampForever;  
 right.wrapMode = WrapMode.ClampForever;
  
 back.layer = 1;
 forward.layer = 1;
 left.layer =1;
 right.layer = 1;  
  
 back.weight = 5;
 forward.weight = 5;
 left.weight = 5;
 right.weight = 5;
  
 }
 function FixedUpdate () {
 //settaggio variabili con cui controllare lo spostamento
 currentSpeedLeftRight = Input.GetAxis("Horizontal")*Time.deltaTime*speedLeftRight;
 currentSpeedBackForward = Input.GetAxis("Vertical")*Time.deltaTime*speedBackForward;
 currentSpeedUpDown = Input.GetAxis("Fire1")*Time.deltaTime*speedUpDown;
 //esecuzione animazione
 if (Input.GetAxis("Horizontal") >= 0.001){
 animation.CrossFade("left", 1);
 }
 else if (Input.GetAxis("Horizontal") <= -0.001){
 animation.CrossFade("right", 1);
 }
 if (Input.GetAxis("Vertical") >= 0.001){
 animation.CrossFade("forward", 1);
 }
 else if (Input.GetAxis("Vertical")  <= -0.001){
 animation.CrossFade("back", 1);
 }
 Debug.Log("Input Orizzontale è"+Input.GetAxis("Horizontal"));
 Debug.Log("Input Verticale è"+Input.GetAxis("Vertical"));
 }
               Comment
              
 
               
              Your answer
 
 
             Follow this Question
Related Questions
Changing AnimationState weights does screw up Crossfading.. 1 Answer
Animation Sometimes Shows Error dt >= 0 0 Answers
Mixing Animations 0 Answers
Crazy weird input script order glitch please help! 1 Answer
How to mix animations ??? 2 Answers
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                