Here's my orbit code:
#constant X_PLANE 0
#constant Y_PLANE 1
#constant Z_PLANE 2
function SetObjectOrbit( planet, moon, dist#, angle#, plane )
a# = sin(angle#) * dist#
b# = cos(angle#) * dist#
select plane
case X_PLANE
SetObjectPosition( moon, GetObjectX(moon), GetObjectY(planet)+a#, GetObjectZ(planet)+b# )
endcase
case Y_PLANE
SetObjectPosition( moon, GetObjectX(planet)+a#, GetObjectY(moon), GetObjectZ(planet)+b# )
endcase
case Z_PLANE
SetObjectPosition( moon, GetObjectX(planet)+a#, GetObjectY(planet)+b#, GetObjectZ(moon) )
endcase
endselect
endfunction
To do what you're wanting to do you would call it with:
SetObjectOrbit( 1, 50, 6, angle#, Z_PLANE )
angle# will need to be increased in order to see the 'moon' orbit the 'planet'. You could set that to be the same as Timer() to test it.
Note: If you try orbiting in multiple planes then you may suffer from
Euler lock. In which case you would be better using quaternions but they are not for the faint hearted!
AGK V2 user - Tier 1 (mostly)