Move an object along a vector

I’d like to move an object along a vector coordinate. Something like that : Vector (0.4162, 0.7786, 0.4696)
I suppose this is possible but I don’t know how to do. Any help to start is welcome :slight_smile:

Thanks!

So that vector is the direction vector, what about the local vector? You will need two vectors unless your origin is always global (0,0,0). With two vectors, simply lerp them: v1.lerp(v2, 0.5) (center of both coordinates)

Yes I was talking about a direction vector (like the one from the face normal). Do I need something else?
I want for example to give to my object x units on the direction of the vector or in the opposite side.

You must normalize the vector and then apply to the location:


v1 = mathutils.Vector((0.4162, 0.7786, 0.4696))
v1.normalize()


objloc = bpy.context.object.location
for pos in range(0, 10):
    for i in range(0, 3):
        obj.location[i] = objloc[i] + (pos * v1[i])



I have not tested the code, but I think will work

Oh thank you!!! This is perfect :slight_smile: