x


Perform Action on frame/time of animation

Hi, all! I have an animation of my character reaching behind his back, grabbing his sword, and bringing it out again when I press 'Q'. (Yes, i have it properly blended with the Idle cycle and whatnot ;D )

I would like to parent the sword to the hand bone when the animation reaches a specific time. I have gotten as far as

if(animation["DrawSword"].time == 0.2){
Debug.Log("Gotcha!");
}

My only problem is that this will not work. I promise the animation is longer than 0.2 seconds. It seems to only work when I set it to 0. How do I get this to work?

more ▼

asked Nov 15 '11 at 02:41 AM

Youngapprentice gravatar image

Youngapprentice
108 21 26 27

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

1 answer: sort voted first

Seems like it's trying to hit the exact moment of 0.2, but the frames aren't going to hit that moment.

You might consider changing it to <= 0.2.

more ▼

answered Nov 15 '11 at 03:08 AM

Nemox gravatar image

Nemox
169 11 16 20

I changed it, and even when set to between 5 and 5.2 seconds, the Debug.Log still fires the moment the game is loaded. :/

EDIT Nevermind. I had an OR statement ( || ) instead of an AND statement ( && )

THANK YOU!

Nov 15 '11 at 03:39 AM Youngapprentice
(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:

x5098
x3807
x1962
x160
x98

asked: Nov 15 '11 at 02:41 AM

Seen: 1470 times

Last Updated: Nov 15 '11 at 03:43 AM