I have this script which has a GUI button inside, when i click this button, i want it to make my first person character “teleport” forward in the way it is heading so i have made this script.
function Update () {
if (teleportActive == true) {
transform.position.x += 2.0;
}
}
There is just the problem that, when i use the button it only “teleports” in the x direction (i know that is because it is set to do that), and then when it is “teleporting” it goes to the coordinates 2.0 which it isnt supposed to. I just want it to “teleport” a bit ahead where it is heading. How would i edit the script to make i do that?