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.

Newcomers DBPro Corner / Orbital Code Help...

Author
Message
Sharlenwar
15
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 27th Feb 2011 17:25
Okay, KISTech posted some code about a simple orbit:



Well, I guess I'm having an issue with how to wrap my head around it. If anyone could explain the math and as to why the object would orbit, please elaborate.

Thanks!
Scorpyo
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: italy
Posted: 27th Feb 2011 21:22
check this code and watch the pic

Attachments

Login to view attachments
MattBatt
18
Years of Service
User Offline
Joined: 15th May 2006
Location:
Posted: 28th Feb 2011 09:58
Found similar code in my older projects. With same logic as in the pic Scorpyo posted, it's based on basic trigonometry, and your code is also.

I didn't store the coordinates to different variables etc, so it can look little messy ( and im using darkGDK ), but the basic idea is there.


Only problem I found was that I've added +180 to the angle, can't remember why tho..

Not sure if the problem is you not using the Point Camera -function ? or are you ?

It wasn't my fault ;_;
Sharlenwar
15
Years of Service
User Offline
Joined: 4th Mar 2009
Location:
Posted: 3rd Mar 2011 13:20
Well, I'm trying to have objects orbit other objects basically. For example, you would move your spaceship to a planet, and when your ship gets close enough to the planet, it will begin to orbit around the planet.

So I have just been wondering how the math works for it all. Scorpyo has helped with the example provided. I'm going to move forward here and see what I can do when I get home from work.

Login to post a reply

Server time is: 2024-11-23 03:10:23
Your offset time is: 2024-11-23 03:10:23