Getting a point base on move direction

I’m working on a game with teleportation base on the move direction of the player. I know I can get direction with velocity but i’m having a hard time translating that into a point where the player will be ported to.

If the teleport is based on some kind of velocity you can do:

transform.position = transform.position + velocity * factor;

‘factor’ is a float that scales how far to move.

If it is based on distance, then:

transform.position = transform.position + velocity.normalized * distance;

Well, your question isn’t very clear.
To translate, you simply need to put: transform.Translate(your Vector3);

transform.Translate is basically the same as: transform.position = transform.position + your Vector3

it “adds” to the current position.

If you want to do it based on the player rotation, you need to type : transform.Translate(transform.rotation * (your Vector3))

so, it’ll translate in the “local axis”.

Here’s an exemple of a simple movement via transform.Translate:

var movement;

movement = Vector3(0,0,Input.GetAxis("Vertical"));
transform.Translate(transform.rotation * movement);

It should move the object in the current direction it is facing according to the Vertical Axis Input.

I Haven’t tested it yet, but it should be something like that :slight_smile: