x


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"));
}
more ▼

asked Jun 22 '11 at 11:53 AM

anwe gravatar image

anwe
114 31 34 38

(comments are locked)
10|3000 characters needed characters left

0 answers: sort oldest
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:

x5078
x3786
x82
x31

asked: Jun 22 '11 at 11:53 AM

Seen: 607 times

Last Updated: Jun 22 '11 at 11:53 AM