Hi,
I want to trigger a game object by a script.
In fact I’ve got a game object with BoxCollider, Rigidbody and Configurable Joint like it was described in the 2D-Game-Tutorial.
Also I’ve allocated an animation to this GameObject.
My FPC has got a BoxCollider too and I thought, when the FPC-Box hits the GameObject-Box the animation will be played - and when the FPC leaves the other Box, the animation will reset or play another animation.
But how to script this?
That’s my try but that’s my first script…
var animationRoot : Animation;
function OnTriggerEnter (col : Collider)
{
var controller : FirstPersonController = col.GetComponent(FirstPersonController);
if (controller != null)
{
Animation.clip;
animationRoot.wrapMode = WrapMode.Once;
}
}