- Home /
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?
Answer by Nemox · Nov 15, 2011 at 03:08 AM
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.
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 Never$$anonymous$$d. I had an OR statement ( || ) ins$$anonymous$$d of an AND statement ( && )
THAN$$anonymous$$ YOU!
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
How to get gun to move with models hand? 1 Answer
Problem controller and Photon networking 0 Answers
Walking Animation Won't Work :( 1 Answer
Animation spins wildly after completed 0 Answers