okay… so i’ve tried but failed, im trying to make it so when the player holds “Q” the player leans to the left with an animation.
heres my code so far:
function Update () {
// INPUT
var isLeaningL : boolean = false;
if (Input.GetKeyDown(KeyCode.Q)){
isLeaningL = true;
print('leaning');
}
if (Input.GetKeyUp(KeyCode.Q)){
isLeaningL = false;
print('notleaning');
}
// ACTIONS
animation.wrapMode = WrapMode.Clamp;
if(isLeaningL) {
animation.CrossFade("leanL");
}
if(isLeaningL == false) {
animation.CrossFade("idle",1);
}
}
this will get me as far as making the whole screen shift a tiny amount in about one frame (as if both animations are being played at the same time?)
im just look for a bit of code that will: on Q down play the animation leanL and then hold the last frame in the animation, then on Q up return to idle…
any help or direction would be most appreciated