Teleportation

Hi, I have made a teleportation cube in my game, so when you touch it, it teleports you, using this code:

var destination : Transform;

function OnTriggerEnter(other : Collider) {
other.transform.position = destination.position;
}

but i want to make it so no matter where i am, if i press a key, i teleport to my destination, thank you!

var other : GameObject;
var destination : Transform;

function Update () {
    if (Input.GetKey (KeyCode.F5)) { 
    other.transform.position = destination.position; 
    }
}

And just assign your player and the destination in the inspector.

http://unity3d.com/support/documentation/ScriptReference/Input.GetKey.html
http://unity3d.com/support/documentation/ScriptReference/KeyCode.html

You might want to use GetKeyDown instead… but this should get you started.