Hi,
I'm new too scripting and have a hit a little bump when it comes to getting an animation to work. What I am doing is just creating a simple box that raises up out of the ground to make a barricade when the player enters a specific location.
So I have my Animation and it's attached to the Box, but I attempt to move the Box the animation with reset the Box back to the origin (where I animated). To fix this I've placed the box in a new GameObject titles Animated_Cube.
How do I in script tell the Box within Animated_Cube to play? Right now my script looks at Animated_Cube and says there's no animation attached and gives an error.
//Apply to Object that triggers animation
//Animated Object and it's Animation
var raiseableGate : GameObject;
var gateAnimation : AnimationClip;
function OnTriggerEnter ()
{
//Removes object that triggered Animation
Destroy(gameObject);
//Plays Animation on the specified GameObject
raiseableGate.animation.Play ("gateAnimation");
}
Any help would be much appreciated!