title: gravity simulation
body: <p>I want to simulate a free fall and a collision with the ground (for example a bouncing ball). The object will fall in a vacuum -  an air resistance can be omitted. A collision with the ground should causes some energy loss so finally the object will stop moving. I use JOGL to render a point which is my falling object. A gravity is constant (-9.8 m/s^2). </p>
  
  <p>I found an euler method to calculate a new position of the point:</p>
  
  <pre><code>deltaTime = currentTime - previousTime;
  vel += acc * deltaTime;
  pos += vel * deltaTime;
  </code></pre>
  
  <p>but I'm doing something wrong. The point bounces a few times and then it's moving down (very slow).</p>
  
  <p>Here is a pseudocode (initial pos = (0.0f, 2.0f, 0.0f), initial vel(0.0f, 0.0f, 0.0f), gravity = -9.8f):</p>
  
  <pre><code>display()
  {
       calculateDeltaTime();
       velocity.y += gravity * deltaTime;
       pos.y += velocity.y * deltaTime;
  
       if(pos.y &lt; -2.0f) //a collision with the ground
       {
          velocity.y = velocity.y * energyLoss * -1.0f;
       }
  
  }
  </code></pre>
  
  <p>What is the best way to achieve a realistic effect ? How the euler method refer to the constant acceleration equations ? </p>