- Home /
Collision on a certain frame
Hello Unity3D i have a question about collision.How can i make it that i can trigger a collision on a certain frame?For example i have a punch animation with 15 frames and the 7th frame has the punch.How can i make it that when its the 7th frame it makes collision and no other frame?
Answer by MrSoad · Oct 13, 2014 at 07:59 PM
As the animation is always the same length you can simply trigger the script that the OnCollisionEnter() function would have triggered after a delay using a "yield" statement for the correct amount of time you wish to delay it by.
(Edit: You may want to use some sort of time.Deltatime code to make sure your delay is always correct)
(Edit 2: Could you not parent a collider to the fist of the arm object and run your OnCollisionEnter() event from a script on this collider?)
Your answer
Follow this Question
Related Questions
A node in a childnode? 1 Answer
AI to make an object wander around and avoid obstacles? 5 Answers
Collision problem 0 Answers