- Home /
Player Collides with object then play animation
Hi I need help?
I would like a the player when it Collides with an object then it plays an animation but I want the script to be able to be used multiple times for different animations...
Thanks
Also Javascript would be better but what ever is easier for the helper :)
Nobody is going to write scripts for you. Do some tutorials on collision and playing animations and you should be able to work it out.
I wrote a script but the player fell through the object
Here it is
var Clip : AnimationClip;
function OnTriggerEnter(other : Collider) { if(other.gameObject.tag == "Player") { animation.Play(""); } }
But i need the player not to fall through it and i dont think the animation played either
Answer by Ingen · Aug 03, 2012 at 01:57 AM
use OnCollisionEnter(collision : Collision), without the trigger
http://docs.unity3d.com/Documentation/ScriptReference/Collider.OnCollisionEnter.html