 # Moving along another object's local coordinates

I was wondering whether it’s possible to move an object along a different object’s local coordinates, both in Blender and in the Game Engine (using python if necessary). I’m essentially trying to move a sphere in the direction that arrow-shaped object is pointing, with the user moving the sphere forwards with “upkey” and rotating the arrow with “leftkey” and “rightkey.” Maybe I could track the arrow’s rotational movement to a property or something like that?

Happy Blendering!!!

Musicaljelly

Yes it is possible.

First you have to get the Orientation of the object and use your calculus skills to extract the 3 rotation values out of a matrix. Once you have the radians for all three axises convert the radian to tan (slop) and manipulate the slop as you see fit.

lol. Those aren’t calculus skills. I had to do that in 8th grade in IMP

lol, what, calculating the height of a ladder if it makes a 60 degrees angle with a 5m tall building?

lol. Those aren’t calculus skills. I had to do that in 8th grade in IMP
Right

What I was referring to was that you would need to get the Orientation (3X3 matrix) and convert it to Euler angles like so:

``````
def getEulerAngles(matrix):
rotation = [0,0,0]
rotation = atan2(-matrix,matrix)
rotation = asin(matrix)
rotation = atan2(-matrix,matrix)
return rotation

``````

Then convert the returned Euler angles (which are returned as radians) to tan and get the hyperbola from the tan angles. Next, divide the distance you want to move on an axis from the hyperbola . The value dist/hyperbola should then be multiplied by the tan. If done correctly with all three axises, you will get the new x,y,z position based on the Orientation.

If were both thinking of the same thing, I seriously doubt that you would learn something like this is 8th grade. Perhaps you learned a simple 2d concept of this idea in grade school , but don’t forget that this is 3D. If you do not account the 3th axis, you will get gimbol lock and many other troublesome problems and errors.

musicaijelly: if the “mathematical” ways seems too complex, you could just set the Orientation equal to the Orientation of the other object. Then use a motion actor to move along the local axis. Once the object is moved, you could set your object back to it’s original Orientation stored in memory.

If were both thinking of the same thing

I wasn’t thinking the same thing, I was mocking him I wasn’t thinking the same thing, I was mocking him lol, I know. That wasn’t directed towards you.