Check for collision while animating
I have an animation 0.24 sec long (Hammer Hitting). All I want to do is check if the hammer collider collided while playing animation and do something, and do something else if the animation finished without colliding sounds simple but I dont know why its not working currently I am starting a function (Lets call it function A) that runs yield WaitForSeconds(0.24);
at the same time I call anim.SetTrigger("HammerHit");
(When the mouse is clicked) and on OnCollisionEnter I have a bool called col
that turns true
if collided and that's how I know a collision happend , after yield WaitForSeconds(0.24);
if col = false
that means no collision happens that's basically what I have. Whats currently happens is it most of the time works,Great. But some times it dose what is on function A after yield WaitForSeconds(0.24);
(which suppose to happen only if there is no collision) and at the same time it dose whats on OnCollisionEnter (which suppose to happen only if there is a collision) am sure am doing it long or in a wrong way but basically what I want is Do something if collided while animating and do something else (after animation is done) if there is NO collision while animation
Your answer
![](https://koobas.hobune.stream/wayback/20220612051612im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Trying to make a Parkour Platformer! 0 Answers
Help with a door slam trap 0 Answers
I want my character to enter and exit car with animation 1 Answer
Animation trigger reset before starting animation 1 Answer
ANIMATION STRANGELY DOES NOT PLAY 0 Answers