# Linear movement of object in scene from one place to another place

Not an object but camera, I am making first person camera movement. I want it move from one place to where I click on floor. I have managed to achieve this by lerp but the issue is that if destination position is very far it moves really fast initially and slows down at the end. I want linear movement regardless of how much is distance. Right now the step of lerp is directly proportional to the distance camera has to travel but i want the step of movement to be constant.
is it possible?
You can check the demo

You can just calculate the direction from the camera to the target, normalize it (ie. make the direction vector to have a length of 1), then multiply by the constant step.

``````// NOTE Kinda safest to repeat these all calculations on each frame, although most can also be done only once
const step = 0.5;

const origin = new Vector3();
const target = new Vector3();
const direction = new Vector3();

camera.getWorldPosition(origin);
object.getWorldPosition(target);

direction.copy(target).sub(origin); // NOTE end position - start position = direction from start to end

if (direction.length() < step) {
// NOTE Camera is closer to the object than a single step, so just move it to the target position