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?
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.
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.