Cant Play Animation ?

Well I made a new clip, resized the object to make animation, and attached it to this script below of which is on the pole. I want it so that when a ball collides with the pole it plays the animation but it is not working >.<

var clip : AnimationClip;

function OnCollisionEnter () {

animation.Play(animation.clip.name);

yield WaitForSeconds (animation.clip.length);

}

Script attached to - Pole

What I wasnt to activate collision on touching Pole - Ball

Am I doing something wrong? Do I need to add the script to the ball or something idk …

anyone?

A first step would be to go:

var clip : AnimationClip;

//note i've changed this function - it accepts a parameter. i'm a C# man, but i assume in JS it's the same - this won't be called
//if it doesn't have the same parameters
function OnCollisionEnter(collision : Collision) {

[indent]

Debug.Log("Collision entered!");

animation.Play(animation.clip.name);

yield WaitForSeconds (animation.clip.length);
[/indent]
}

Try it out.

If you don’t see the Debug message, it’s your collider setup that’s incorrect.

If you do and it doesn’t animate, then it’s an issue with the animation.

Good luck!

-JFFM

ty I figured out =)

i don´t understand here.

have an varible “var clip : AnimationClip”

and

animation.Play(animation.clip.name); -------------------------> “name” is to put the name of varible "clip???
yield WaitForSeconds (animation.clip.length);

in this case.

var reloadClip : AnimationClip;

How to use the var “reload” whit the rest???

I´m Confuse!!