Skip to content

Instantly share code, notes, and snippets.

@thomasjmwb
Created March 28, 2012 12:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasjmwb/2225749 to your computer and use it in GitHub Desktop.
Save thomasjmwb/2225749 to your computer and use it in GitHub Desktop.
Unity scripting example #1
#pragma strict
function Start () {}
function Update () {}
function OnTriggerEnter (myTrigger : Collider) {
//when player walks into the trigger
if(myTrigger.gameObject.name == "singleTest_Camera"){
Debug.Log("collision start");
teleportCamera();
}
}
function teleportCamera()
{
var go = GameObject.Find("singleTest_Camera");
//teleport player to new zone
go.transform.position.x=-615.8708;
go.transform.position.y=-4374.298;
go.transform.position.z=1691.007;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment