x


aiming with animation

i want to have animation of aiming. i wrote my own script for it and its not working properly. every time i hold on the the right mouse button, the animation keep getting played over and over. is there a way to fix that?

here is the script.

var PlayAim = false;

function Update(){

if(Input.GetButton("Fire2")){

gameObject.animation["Aim"].speed= 6;

    animation.Play("Aim");

}

if(!Input.GetButton("Fire2")){

gameObject.animation["Aim"].speed = -6;

}

}

more ▼

asked Feb 26, 2012 at 12:04 AM

LoopyEL_BARTO gravatar image

LoopyEL_BARTO
1 6 4 5

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

1 answer: sort voted first

make sure that your aiming animation is not set to loop

more ▼

answered May 18 at 10:38 AM

VisionNext gravatar image

VisionNext
1

(comments are locked)
10|3000 characters needed characters left
Your answer
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:

x6458
x1593
x1485
x1404
x161

asked: Feb 26, 2012 at 12:04 AM

Seen: 1026 times

Last Updated: May 18 at 10:38 AM