The Daily Click ::. Forums ::. Klik Coding Help ::. Trigonometry Planets
 

Post Reply  Post Oekaki 
 

Posted By Message

vetmora120



Registered
  07/01/2010
Points
  273
9th November, 2012 at 09/11/2012 03:43:08 -

Hi all,

Another questions for you. Can't seem to get my head around this one.

I have a planet object that will orbit around a star object using the Sin and Cos formulas:
Y Pos = Origin Y + Sin( Angle ) * Radius
X Pos = Origin X + Cos( Angle ) * Radius

I know to make the planet move I just add to the Angle Alterable Value. But say I wanted the planet to take X amount of time to orbit. For example, the planet should take 69700000 seconds to orbit its star in real time.

How can I work out how much to add every second (or variable unit of time) to make it rotates 360 degrees in 69700000 seconds?

 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
9th November, 2012 at 09/11/2012 03:48:58 -

Umm, that's a lot of seconds.
A plain easy way would be to have a value add 1 every second and when the counter hits 193611 move one degree and set the counter to 0. Not completely accurate but ~

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

Alonso Martin



Registered
  29/12/2010
Points
  294
9th November, 2012 at 09/11/2012 04:03:23 -

Setting the angle to CurrentSecond*360.0/69700000 doesn't work?

 
www.hfalicia.com
www.alonsomartin.mx

vetmora120



Registered
  07/01/2010
Points
  273
9th November, 2012 at 09/11/2012 04:25:16 -

Thanks for all the answers. I'll try them both when I get home from work.

I know it's a lot of seconds. I'm gonna have a slider to increase the scale of time but I just wanted to use the real time to get the formula accurate.

Thanks again.

 
n/a

Eternal Man [EE]

Pitied the FOO

Registered
  18/01/2007
Points
  2955

Game of the Week WinnerHero of TimeLOL SignI am an April Fool
9th November, 2012 at 09/11/2012 13:43:18 -

Ha, it's actually 2.24 years worth of seconds
Are you making a stellar simulator or something?
Anyway, if you are including a way to alter the time needed for one orbit you really need to use a formula like Alonso Martin showed. Otherwise all kinds of problems can arise.

 
Eternal Entertainment's Code'n'Art Man

E_E = All Indie


...actually Ell Endie, but whatever.
Image
Image

vetmora120



Registered
  07/01/2010
Points
  273
10th November, 2012 at 10/11/2012 11:11:25 -

Yeah that's correct EE. I may be making a stellar simulator. Just maybe.

 
n/a
   

Post Reply



 



Advertisement

Worth A Click