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?
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 ~
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.
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.