Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

// DGH1 // Oisin Bourke #pragma strict // The two main variables are the Transform, which references an object

(the tra pdoor in my scene) // and a Boolean which checks if the doop is open. var target : Transform; var doorOpen = false; // The following function activates whenever a collider passes through it's atta ched object( My collider box named "MyCube" in my scene) function OnTriggerEnter(myTrigger:Collider) { // if-statement, is it the character that collided with the object? if(myTrigger.gameObject.name =="character"){ // This next line merely confirms that the trigger was activated Debug.Log("Character Entered Trigger Area"); // Open the door doorOpen = true; } } // This function checks to see if the doorOpen=true as in above, if it is it rot ates my trapdoor to 35 on the X axis function Update(){ if(doorOpen==true){ target.rotation.x=35; } }

You might also like