# setPosition along a local axis with python?

After , i thinking about and do some search in this forums cant find the right way how can i set an object relative position along a specified axis.
My first idea was, get orientation of the object and than calculate the i.e. the z axis vector
and than multiplying along the vector (i.e. z axis) and set that value as the next position.
In the end if i set a value 1, 2, 3, stb. than object move along x axis 1,2, or 3 unit.
I know about the set velocity things but i dont want to use physics and i would like set an object an exact position and distance.
Someone have some clue or idea how can i do this?
Please help You could use dLoc. That d is “Delta” if you didn’t know, meaning its the exact change of location. Click the L button to keep it local.

If you’re trying to do it in python you could use some trigonometry, I don’t know how to get the euler angle for the z rotation but once you get that you can use something like this:

``````hyp = 5
x = cos(angle) * hyp
y = sin(angle) * hyp
``````

hyp being the hypotenuse which will be the distance to travel.

Hey! Thanks for helps After all i found a not so elegant way but seems it works: