Hey everyone.
I'm having issues that have almost got me to breaking point now, so I'm hoping someone can help.
Basically, I have planets, and around them are two light sources (for shaders - lets just consider them two "moons" around a planet). I need them to place on opposite sides, which I have done, and then NOT move as I rotate the planet object (light side of the planet, dark side of the planet)....until zooming in on the planet, at which point I need to rotate the two light sources WITH the planet but in position so that they can be fixed and you can move from the light side to the dark side.
I have this working perfectly in this code by fixing the two moon objects to the planet:
x# = sin( getobjectx(1)+100 ) * 150.0
z# = cos( getobjecty(1)+160 ) * 150.0
x2# = -sin( getobjectx(1)+100 ) * 150.0
z2# = -cos( getobjecty(1)+160 ) * 150.0
SetObjectPosition( 6, x#/10, 0.0, z#/10 )
SetObjectPosition( 7, x2#/10, 0.0, z2#/10 )
Objects 6 + 7 are the moon objects. However, if you rotate or scale the object before fixing, they randomly jump to completely new locations the the lighting is completely messed up. I have also tried using fixobjectpivot on the planet first to reset it's rotation to zero but keep it as is, however unless the planet is at location 0,0,0 then this then starts moving in it's own elliptical orbit when rotated, and the moon objects move even more erratically.
Has anyone got any ideas?