|
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!
(comments are locked)
|
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. thank you that works!
Jun 15 '12 at 10:32 PM
Bruno Fludzinski
(comments are locked)
|
