I’m trying to do just a simple (i.e. really simplified) approximation of one object orbiting another abject that is itself orbitting another in 3D.

Using local position transformation, I’m able to have the engine calculate relative X and Z coordinates using a radius and frequency, then I’m using the Y axis from the parent object. (The parent object is just moving in a straight line right now so its y value is just increasing as the time elapses.)

So this gives me a perpendicular plane of orbit for my first child. Then in order to simulate a tilted orbit, I think I just need to calculate the amount of deflection from Y based on a limited radius equal to the angle of maximum tilt. This all works well so long as I assume the parent object is moving in a straight line along the one axis.

Where I’m having trouble is I want to have a third object orbiting the first child but because the direction of motion of the second object is no longer linear (keeps changing as it spirals around the first object), I can’t figure out how to calculate the Y value correctly.

If I could figure out an equation to figure out the direction of the perpendicular, relative Y of the second object, I would be able to then calculate the new Y position, including any wobble, for the third object. But my parent object only has its own current position (vector position) and can’t tell me about the plane or direction of its own movement.

Visualizing what is happening in my head if I were to draw a line following the pole I could see that line processing relative to the primary object, but I can’t figure out how I would calculate that simply.

Does anyone have logic or mathematical suggestions? Library suggestions?