Jump to content

  • Log In with Google      Sign In   
  • Create Account

#ActualAzaral

Posted 28 January 2014 - 12:06 PM

Instead of updating position each tick and storing it you can do something else.

You can create a function that would take the planet and a time variable that is the time passed in the universe since the beginning. It could be of any unit you want, your function would just have to take it into account. Then, whenever you need to deal with the planet's position, you simply calculate it based on the time passed and the properties of the planet (orbit speed, starting location, etc). This way, you avoid having to update any planet's positions and instead just calculate it on the fly when needed. You turn 20,000 updates a tick into one calculation whenever you need it. This would work for any property, orbit position, planet rotation, pretty much anything that is constant with the flow of time, which luckily with space, almost everything is until it get's acted on by something else.

You could use this for any object moving at a constant rate, or for any object you have a constant force on.

As I think, you just need a position function, which is derived from a velocity function, which is derived from an acceleration function, which is derived from a force function.

 

Acceleration = mass / force

 

Position = ( ( acceleration + initial acceleration ) * time ^ 2 ) / 2 + ( velocity + initial velocity ) * time + starting position

 

There are similar functions for a lot of different things, like orbits and what not.

 

You could also have forces chance, but you would have to update your initial acceleration, velocity, and position values.

 

You could also update the variables each time the object's position is calculated to keep it 'current'.
 


#3Azaral

Posted 28 January 2014 - 11:57 AM

Instead of updating position each tick and storing it you can do something else.

You can create a function that would take the planet and a time variable that is the time passed in the universe since the beginning. It could be of any unit you want, your function would just have to take it into account. Then, whenever you need to deal with the planet's position, you simply calculate it based on the time passed and the properties of the planet (orbit speed, starting location, etc). This way, you avoid having to update any planet's positions and instead just calculate it on the fly when needed. You turn 20,000 updates a tick into one calculation whenever you need it. This would work for any property, orbit position, planet rotation, pretty much anything that is constant with the flow of time, which luckily with space, almost everything is until it get's acted on by something else.

You could use this for any object moving at a constant rate, or for any object you have a constant force on.

As I think, you just need a position function, which is derived from a velocity function, which is derived from an acceleration function, which is derived from a force function.

 

Acceleration = mass / force

 

Position = ( ( acceleration + initial acceleration ) * time ^ 2 ) / 2 + ( velocity + initial velocity ) * time + starting position

 

There are similar functions for a lot of different things, like orbits and what not.

 

You could also have forces chance, but you would have to update your initial acceleration, velocity, and position values.

 


#2Azaral

Posted 28 January 2014 - 11:28 AM

Instead of updating position each tick and storing it you can do something else.

You can create a function that would take the planet and a time variable that is the time passed in the universe since the beginning. It could be of any unit you want, your function would just have to take it into account. Then, whenever you need to deal with the planet's position, you simply calculate it based on the time passed and the properties of the planet (orbit speed, starting location, etc). This way, you avoid having to update any planet's positions and instead just calculate it on the fly when needed. You turn 20,000 updates a tick into one calculation whenever you need it. This would work for any property, orbit position, planet rotation, pretty much anything that is constant with the flow of time.


#1Azaral

Posted 28 January 2014 - 11:22 AM

Instead of updating position each tick and storing it you can do something else.

You can create a function that would take the planet and a time variable that is the time passed in the universe since the beginning. It could be of any unit you want, your function would just have to take it into account. Then, whenever you need to deal with the planet's position, you simply calculate it based on the time passed and the properties of the planet (orbit speed, starting location, etc). This way, you avoid having to update any planet's positions and instead just calculate it on the fly when needed. You turn 20,000 updates a tick into one calculation whenever you need it.


PARTNERS