I want to activate two animations, but don’t know how to do it. My script has two variable animation clips like this:
var ElevatorDoor : AnimationClip;
var Elevator : AnimationClip;
I just need the line to activate those, because I already have set up everything else
Here’s the whole code if it helps:
#pragma strict
@script RequireComponent( AudioSource )
var distanceToElevatorButton : float = 2.5;
var ElevatorDoor : AnimationClip;
var Elevator : AnimationClip;
function Start()
{
Screen.lockCursor = true;
}
function Update()
{
if ( Input.GetMouseButtonDown(0) || Input.GetKeyDown(KeyCode.E) )
{
var ray = Camera.main.ScreenPointToRay( Vector3( Screen.width * 0.5, Screen.height * 0.5, 0.0 ) );
var hit : RaycastHit;
if ( Physics.Raycast( ray, hit, distanceToElevatorButton ) )
{
if ( hit.collider.gameObject.name == "ElevatorButton" )
{
//This is where I want my animation to start...
}
}
}
}
I hope you guys can help