Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Orbit of an object

Author
Message
Epipfany Game Studios
16
Years of Service
User Offline
Joined: 5th Feb 2008
Location:
Posted: 24th Feb 2008 21:33
I need to have an object orbit around another object but that base object can also move much like how earth orbits around the sun and our moon orbits earth.
Thanks

Thanks,
Terry
Diggsey
18
Years of Service
User Offline
Joined: 24th Apr 2006
Location: On this web page.
Posted: 24th Feb 2008 22:17 Edited at: 24th Feb 2008 22:18
orbitx = sin(angle from base object)*distance + base object position x
orbitz = cos(angle from base object)*distance + base object position z

To get it to rotate, just increase the angle a bit each time.

Codger
21
Years of Service
User Offline
Joined: 23rd Nov 2002
Location:
Posted: 24th Feb 2008 23:15 Edited at: 24th Feb 2008 23:16
This might get you started



Use the arrow keys to rotate

Codger

System
PIV 2.8 MZ 512 Mem
FX 5600 256 mem
Epipfany Game Studios
16
Years of Service
User Offline
Joined: 5th Feb 2008
Location:
Posted: 25th Feb 2008 15:19
Ok I found some code on the darkbasic forums that helped except a little issue I ran into is it seems that my planets seem to either orbit an arbitrary point or intersect with the object I am orbiting. the arbitary point comes when i take half the radious as my start x point to start my orbiting object and it seems to orbit some arbitary point above my object. any ideas?

Thanks,
Terry

Login to post a reply

Server time is: 2024-09-29 13:24:21
Your offset time is: 2024-09-29 13:24:21