Skip to main content
added code
Source Link
Quonux
  • 1.2k
  • 1
  • 12
  • 19

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.


Why is energy loss better than the addition of energy over time?

Because the objects in the gameworld will get eventually to an halt. This is good because the object can be put to sleep and it doesn't need any more calculations for the collision if no object is near it.

It is also better because your gameworld can't 'explode' because everything collides with everything.


Pseudocode for the constant time verlet integration with drag

Friction for an object can be simulated with the usage of the Acceleration field of an object

PhysicsObject has Vector2 OldPosition Vector2 CurrentPosition // difference between the two is the speed float Dragfactor // 0.0f ... 1.0f Vector2 Acceleration // Timestep is the time in seconds of a timestep, can be/is a constant physics.timestep() { foreach PhysicsObject as IterationPhysicsObject { Speed = (IterationPhysicsObject.CurrentPosition - IterationPhysicsObject.OldPosition) Speed.scale(IterationPhysicsObject.Dragfactor); IterationPhysicsObject.OldPosition = IterationPhysicsObject.CurrentPosition; IterationPhysicsObject.CurrentPosition = IterationPhysicsObject.CurrentPosition + Speed + IterationPhysicsObject.Acceleration * Timestep * Timestep; // reset acceleration IterationPhysicsObject.Acceleration = new Vector2(0.0f, 0.0f); } } 

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.


Why is energy loss better than the addition of energy over time?

Because the objects in the gameworld will get eventually to an halt. This is good because the object can be put to sleep and it doesn't need any more calculations for the collision if no object is near it.

It is also better because your gameworld can't 'explode' because everything collides with everything.

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.


Why is energy loss better than the addition of energy over time?

Because the objects in the gameworld will get eventually to an halt. This is good because the object can be put to sleep and it doesn't need any more calculations for the collision if no object is near it.

It is also better because your gameworld can't 'explode' because everything collides with everything.


Pseudocode for the constant time verlet integration with drag

Friction for an object can be simulated with the usage of the Acceleration field of an object

PhysicsObject has Vector2 OldPosition Vector2 CurrentPosition // difference between the two is the speed float Dragfactor // 0.0f ... 1.0f Vector2 Acceleration // Timestep is the time in seconds of a timestep, can be/is a constant physics.timestep() { foreach PhysicsObject as IterationPhysicsObject { Speed = (IterationPhysicsObject.CurrentPosition - IterationPhysicsObject.OldPosition) Speed.scale(IterationPhysicsObject.Dragfactor); IterationPhysicsObject.OldPosition = IterationPhysicsObject.CurrentPosition; IterationPhysicsObject.CurrentPosition = IterationPhysicsObject.CurrentPosition + Speed + IterationPhysicsObject.Acceleration * Timestep * Timestep; // reset acceleration IterationPhysicsObject.Acceleration = new Vector2(0.0f, 0.0f); } } 
added 134 characters in body
Source Link
Quonux
  • 1.2k
  • 1
  • 12
  • 19

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.


Why is energy loss better than the addition of energy over time?

Because the objects in the gameworld will get eventually to an halt. This is good because the object can be put to sleep and it doesn't need any more calculations for the collision if no object is near it.

It is also better because your gameworld can't 'explode' because everything collides with everything.

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.


Why is energy loss better than the addition of energy over time?

Because the objects in the gameworld will get eventually to an halt. This is good because the object can be put to sleep and it doesn't need any more calculations for the collision if no object is near it.

It is also better because your gameworld can't 'explode' because everything collides with everything.

added 134 characters in body
Source Link
Quonux
  • 1.2k
  • 1
  • 12
  • 19

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Go withUse constant time verlet integration, not the variable time verlet integration because it voids doesn't have the pro sideadvantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • ? better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.

A higher timestep introduces more calculation errors, it also depends on the used method

Go with constant time verlet integration, not the variable time verlet integration because it voids the pro side of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • ?

contra

  • introduces calculation errors
  • a bit slower than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.

A higher timestep introduces more calculation errors, it also depends on the used integration method.

Use constant time verlet integration, not the variable time verlet integration because it doesn't have the advantages of the verlet integration technique. The advantage of the constant time verlet integration technique is that the enery of the system can only decrease, not increase, which is a very good property of a physics simulation.

Here is a comparisation of some techniques:

Euler integration

pro

  • simple
  • fast

contra

  • energy addition/loss easily possible

Variable time verlet integration

pro

  • better energy conservation property than the euler method

contra

  • introduces calculation errors
  • a bit slower to calculate than euler

Constant time verlet integration

pro

  • ball jumps everytime in the same height
  • no energy addition possible (but loss)

contra

  • a bit more compuation requirement than theeuler integration

how to write code for it

just let the time actor of the variable time verlet integration at the same value.

Source Link
Quonux
  • 1.2k
  • 1
  • 12
  • 19
Loading