Hello,
I have a question regarding the orbit function within EZ rotate.
I can make some spheres, I can get one sphere to orbit the other sphere, however, if I move the centeral sphere, the orbit goes all out of wack.
This is what Ive got...
Rem Project: Dark Basic Pro Project
Rem Created: Friday, January 28, 2011
Rem ***** Main Source File *****
rem // init
sync rate 60
autocam off
position camera 0,0,0,-30
rotate camera 0,0,270,0
rem // make sun
make object sphere 1,10
position object 1,0,0,0
rem // make planet
make object sphere 2,2
position object 2,20,0,0
rem // make moon
make object sphere 3,1
position object 3,22,0,0
rem //set speed of orbit
speed = 1
rem // main loop
do
control camera using arrowkeys 0,1,1
rem // setup rotate for objects
EZro_ObjOrbit 2,1, object position x(1), object position y(1) , object position z(1), object position x(1), object position y(1) +100, object position z(1), speed
EZro_ObjOrbit 3,1, object position x(2), object position y(2) , object position z(2), object position x(2), object position y(2) +100, object position z(2), speed
rem // move object 1
if shiftkey() = 1
move object 1,1
rem//I can get object 2 to follow object 1 and maintain its orbit with the following removed code, however this will not work with a spherical orbit
rem position object 1,object position x(1), object position y(1) , object position z(1) + 1
rem position object 2,object position x(2), object position y(2) , object position z(2) + 1
endif
rem //printing object 2 co-ordinates for observation
print "x: ",object position x (2)
print "y: ",object position y (2)
print "z: ",object position z (2)
rem //alter angle parameter of the EZ rotate function
if controlkey()=1 then speed = 100
if spacekey()=1 then speed = 1
loop
I'm curious as to how you can move an object and maintain the same unaltered orbit for its satellite eg, the radius of the orbit doesnt grow or shrink with movement.
my end goal is to have multiple levels of orbit eg, sun planets moons etc, and id like to be able to move the planets through space without distorted orbits.
Im still a newcomer to Dark basic and im trying to work it out for myself, however on this one, i seem to be going round in circles which is what my planets are meant to be doing.
what am i doing wrong?
thankyou
kezz
Sometimes I like to use words out of contents