Skip to main content
added 111 characters in body
Source Link
doppelgreener
  • 7.3k
  • 7
  • 44
  • 69

Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration

Here lies your problem. It is true that the velocity at the end of the first iteration is 1 m.s¯¹\$1 m.s^{-1}\$. However during that time the object has not travelled 1 m\$1 m\$.

In fact, since the acceleration is constant, the average object velocity is simply 0.5 m.s¯¹\$0.5 m.s^{-1}\$ and thus the object has only travelled 0.5 m\$0.5 m\$. The next frames will be:

time   v   v(avg)  height
  0    0      -     10.0
  1    1     0.5     9.5
  2    2     1.5     8.0
  3    3     2.5     5.5
  4    4     3.5     2.0
  5    5     4.5    -2.5 (collision happened)

$$ \begin{array}{c|c|c|l} \text{time} & \;\; v \;\; & v(avg) & \text{height} \\ \hline 0 & 0 & - & \;\;10.0 \\ 1 & 1 & 0.5 & \;\;9.5 \\ 2 & 2 & 1.5 & \;\;8.0 \\ 3 & 3 & 2.5 & \;\;5.5 \\ 4 & 4 & 3.5 & \;\;2.0 \\ 5 & 5 & 4.5 & -2.5 \text{(collision happened)} \end{array} $$

So, to know the new object position, use the average velocity instead of the new velocity. It will greatly improve your accuracy (in fact, in the case of constant acceleration, it will even give you exact results).

At this points it hits the ground and bounces back with the speed of 10 meters per second.

This is incorrect, too. Where does the value 1010 come from? With your integration method, the velocity should be 4.

Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration

Here lies your problem. It is true that the velocity at the end of the first iteration is 1 m.s¯¹. However during that time the object has not travelled 1 m.

In fact, since the acceleration is constant, the average object velocity is simply 0.5 m.s¯¹ and thus the object has only travelled 0.5 m. The next frames will be:

time   v   v(avg)  height
  0    0      -     10.0
  1    1     0.5     9.5
  2    2     1.5     8.0
  3    3     2.5     5.5
  4    4     3.5     2.0
  5    5     4.5    -2.5 (collision happened)

So, to know the new object position, use the average velocity instead of the new velocity. It will greatly improve your accuracy (in fact, in the case of constant acceleration, it will even give you exact results).

At this points it hits the ground and bounces back with the speed of 10 meters per second.

This is incorrect, too. Where does the value 10 come from? With your integration method, the velocity should be 4.

Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration

Here lies your problem. It is true that the velocity at the end of the first iteration is \$1 m.s^{-1}\$. However during that time the object has not travelled \$1 m\$.

In fact, since the acceleration is constant, the average object velocity is simply \$0.5 m.s^{-1}\$ and thus the object has only travelled \$0.5 m\$. The next frames will be:

$$ \begin{array}{c|c|c|l} \text{time} & \;\; v \;\; & v(avg) & \text{height} \\ \hline 0 & 0 & - & \;\;10.0 \\ 1 & 1 & 0.5 & \;\;9.5 \\ 2 & 2 & 1.5 & \;\;8.0 \\ 3 & 3 & 2.5 & \;\;5.5 \\ 4 & 4 & 3.5 & \;\;2.0 \\ 5 & 5 & 4.5 & -2.5 \text{(collision happened)} \end{array} $$

So, to know the new object position, use the average velocity instead of the new velocity. It will greatly improve your accuracy (in fact, in the case of constant acceleration, it will even give you exact results).

At this points it hits the ground and bounces back with the speed of 10 meters per second.

This is incorrect, too. Where does the value 10 come from? With your integration method, the velocity should be 4.

Source Link
sam hocevar
  • 24k
  • 2
  • 65
  • 95

Say the object is 10 meters above ground. Assume that our dt (delta t) is 1 second. The object goes to the height of 9 meters at the end of the first iteration

Here lies your problem. It is true that the velocity at the end of the first iteration is 1 m.s¯¹. However during that time the object has not travelled 1 m.

In fact, since the acceleration is constant, the average object velocity is simply 0.5 m.s¯¹ and thus the object has only travelled 0.5 m. The next frames will be:

time   v   v(avg)  height
  0    0      -     10.0
  1    1     0.5     9.5
  2    2     1.5     8.0
  3    3     2.5     5.5
  4    4     3.5     2.0
  5    5     4.5    -2.5 (collision happened)

So, to know the new object position, use the average velocity instead of the new velocity. It will greatly improve your accuracy (in fact, in the case of constant acceleration, it will even give you exact results).

At this points it hits the ground and bounces back with the speed of 10 meters per second.

This is incorrect, too. Where does the value 10 come from? With your integration method, the velocity should be 4.