Late response so maybe you have this solved but....
One trick I use to get angle info relative to another object is to set a small invisible cube
CreateObjectBox(cubechild,2,2,2) as a child of the object (ship) with
FixObjectToObject(cubechild,ship) and make sure to use
SetObjectposition(cubechild,0,0,0) and
SetObjectRotation(cubechild,0,0,0) which will place a child exactly where the parent is with the same rotation. That is for pre-loop setup.
In the loop, something like
SetObjectLookAt(cubechild,
GetObjectX(planet),
GetObjectY(planet),
GetObjectZ(planet),
GetObjectAngleZ(ship)).
Now if you read the angle of the child, you can use it as an offset for the ship. Rotate the ship to keep the child near 90 degrees.
Not sure if that's the hard way to do it.
Or for orbit, just get the ship to look at planet then rotate 90 on the Y every time through the loop.
If you search the forum for "radar" you can find some of my code but I've not done orbital stuff yet.
PS- as I'm not that clever with math, I try to find "other ways" to get the job done.

Never play leap frog with a unicorn.
