Hello
I have one animation problem.
My animation is made of 4 elements : Idle, Walk, Shoot, Jump.
I don’t know if this is important to you but here is how these clips are set
Walk - Loop
Idle - Loop
Shoot - Once
Jump - Once
I have made AnimationScript that’s looking like this:
function Update () {
if (Input.GetAxis("Walk"))
animation.CrossFade ("Walk");
else if (Input.GetAxis("Jump"))
animation.CrossFade("Jump");
else if (Input.GetAxis("Fire1"))
animation.CrossFade("Shoot");
else
animation.CrossFade("Idle");
}
Here are some more axis settings:
Walk:
Positive Button: w
Negative Button: d
Alt Positive Button: up
Alt Negative Button: down
Jump:
Positive Button: space
Fire1:
Positive Button: joystick button 0
On the “Shoot” clip, only gun is moving and on the “Walk” clip, gun is not moving (it doesn’t change it’s transform)
When I hold “w” (the player walks forward) and when I press “Fire1”, the player continues walking (nothing about “Walk” clip changes) and the gun doesn’t move but when the “Idle” clip is playing and I press “Fire1”, “Shoot” clip playes.
I tryed writing “if” instead of “else if” but then only “Idle” clip is playing.
Please help me.
Thank you!!!