Hello, I’m still new to Unity and I’ve been trying to create a script that will teleport the player in whichever direction they are facing. So if they are looking up, they teleport up, if they look down they teleport down.
void Update ()
{
if (Input.GetKeyDown(KeyCode.F))
{
character.transform.position += character.transform.TransformDirection(Vector3.forward) * distance;
}
}
Right now this is is what I have, I teleport in whatever direction I’m facing, but it only teleports me along the x and z axis, if I look up I still teleport forward in whatever direction my character is facing on the x and z axis. I’m not sure how to make it teleport me along the y axis up and down. I know .forward is shorthand for (0, 0, 1) but I’m not sure what else to use?
,