# Smooth Movement: Vector to Vector.

I’m not new to Lua, but simple trigonometry is something I’m shit at.

I’m trying to figure out how to move something from one Vector to Another vector by 1 unit per frame. Movement and whatever i know, it’s the maths part of how to tell the entity on Vector A to move VectorA.X VectorA.Y VectorA.Z by 1 unit in the direction of VectorB.X VectorB.Y VectorB.Z.

If somebody could enlighten me that would be fantastic.

[lua]local vec1 = Vector(100, 100, 100);
local vec2 = Vector(200, 300, 0);
local dir = (vec2-vec1):Normalize()
vec1 = vec1 + dir;
end)[/lua]

That’s how I would do it.

**[G.LerpVector

It would be pretty difficult to make the vector increase by only 1 unit a frame if you use LerpVector because it takes a percentage and works out the new vector from that.

[editline]01:46PM[/editline]

You would have to work out what percent of the distance between the two vectors is 1 unit.

Ahhh Normalize i completely forgot about that, thanks NullPoint.

Case has been solved.