- Home /
Trying to animate on collision, Help Please.
I am trying to make it so that when my first person controller hits the Cube, the Cube's animation will play. It doesnt seem to work though, please help!
Here is my Javascript
function OnCollisionEnter (collision : Collision) {
if (collision.gameObject.name == "Player" || collision.gameObject.tag == "Player") {
animation.Play("Take 001");
}
}
Did you try with a Debug message to see if you enter the function and if you enter the condition?
Does the cube have an animation called "Take 001"? Do you have the cube set up with an Animation component, and the "Take 001" animation is one of the available animations?
Did you check in the importing setting, rig tab, the animation type. It should be "legacy". See http://docs.unity3d.com/Documentation/$$anonymous$$anual/Animations40.html I recently lost a couple of hours...
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Mecanim, weapon bone animation woe... 1 Answer
Mesh Collider Does Not Working 1 Answer
Can someone help me with my script? 0 Answers
Walk animation 0 Answers