- Home /
Question by
ImPvEspec · Dec 04, 2012 at 02:55 AM ·
transformbuttonteleportinggetkeydown
Is this how i do a Button activated teleporter.
attached to the vehicle the player controls , and more of a incase u get stuck option. is there something drastically wrong with this
var Receiver : Transform;
function update (){
if (Input.GetKeyDown == "Jump"){
this.gameObject.transform.position = Receiver.position;
}
}
Comment
Are you asking if there is a better way to do this, or is there something actually wrong/not functioning with your script?
that wasnt working i have how ever finished it lol finally
Best Answer
Answer by ImPvEspec · Dec 04, 2012 at 03:17 PM
var player : gameObject
var receiver : gameObject
function FixedUpdate () {
if (Input.GetKeyDown ("space"))
player.transform.position = receiver.transform.position;
}
Description : if u press space bar it teleports the player variable to the location of the receiver.
Your answer
Follow this Question
Related Questions
How to teleport player to gameobject 2 Answers
Need more buttons to this script. 1 Answer
Error CS0119 wont go away 1 Answer
teleportation problems (2d) 1 Answer
Transform translate 1 Answer