|
I have wrote this script which kind of does what I want it too; I want it to play an idle animation if nothing is being pressed play a walk animation when w or s is pressed, play a shoot animation when the LMB is clicked and play a reload animation when r is pressed. All this works but the shoot animation sort of delays which I dont want. Can anyone help me out with this? this is my script, animation.wrapMode = WrapMode.Loop; animation["idle"].speed = 0.2; animation["walk"].speed = 1; animation["reload"].speed = 1; animation["shoot"].speed = 2; animation["shoot"].wrapMode = WrapMode.Once; animation["reload"].wrapMode = WrapMode.Once; animation["shoot"].layer = 1; animation["reload"].layer = 2; animation.Stop(); } function Update () { if (Mathf.Abs(Input.GetAxis("Vertical")) > 0.1) else if(Input.GetButtonDown("Fire1")) if (Input.GetButtonDown("r")) }
(comments are locked)
|
|
Shooting must have instance response.I think your shoot animation is being delayed because of crossfade or transition what ever you http://say.So, stop any previous animation instantly before using shooting animation. if(Input.GetButtonDown("Fire1")){animation.Stop();animation.Play("shoot");} if(Input.GetButtonDown("r")){animation.Stop();animation.CrossFade("reload");} this works great thanks!
Dec 01 '11 at 08:22 PM
Dreave
(comments are locked)
|

What do you mean delayed? It takes time before it begins? Does it do this for all the animations?
if I click the LMB it plays the animation but then I have to wait a couple of seconds before I can do it again.