Hi guys,
So I’ve made a non humanoid 3D character - starting off with a simple run loop and jump animation.
So I’ve setup the animator as Entry > run then jump is in there, so I can refer to it in the script
Run is setup frame 0-20 with Loop Time ticked.
Jump is setup frame 20-40 without Loop Time ticked.
Below is my amateur code got to start somewhere!
#pragma strict
var anim : Animator;
function Start() {
anim = GetComponent.<Animator>();
}
function Update () {
transform.Translate(Vector3.forward * Time.deltaTime * 10);
if(Input.GetKeyDown(KeyCode.Space)){
anim.Play("jump");
transform.Translate(Vector3.up * Time.deltaTime * 10);
} else {
anim.Play("run");
}
}
So the problem is the run animation is playing on a loop (woohoo), which is fine, but when I hit the space bar to make the character jump it only plays the jump animation for a split second before returning to the run animation. Anyway to play the jump animation till the end before returning to the run loop?
Many Thanks