title: How to show if two objects are moving away in 3D space
body: <p>I am working on a yet another 3d game engine and have following Problem. In order to improve Performance I want to check if two Objects are coming closer or moving away from each other. Only if they are coming closer to each other collision detection should happen.</p>
  <p>At the moment the code calculates the current distance using the positions of both Objects. Then moves both positions about the velocity vector and calculates the expected distance. etc.</p>
  <pre><code>public class Model{
  
      public boolean isApproaching(Model model) {
          float [] otherPosition = model.getPosition();
          float [] otherVelocity = model.getVelocity();
          double currentDistance = Math.pow(this.position[0] - otherPosition[0], 2)
                                  + Math.pow(this.position[1] - otherPosition[1], 2)
                                  + Math.pow(this.position[2] - otherPosition[2], 2);
          double expectedDistance = Math.pow(this.position[0] + this.velocityVector[0]/1000 - otherPosition[0] - otherVelocity[0]/1000, 2)
                                  + Math.pow(this.position[1] + this.velocityVector[1]/1000 - otherPosition[1] - otherVelocity[1]/1000, 2)
                                  + Math.pow(this.position[2] + this.velocityVector[2]/1000 - otherPosition[2] - otherVelocity[2]/1000, 2);
          if(currentDistance &lt; expectedDistance)
              return false;
          return true;
      }
  
  }
  </code></pre>
  <p>As you can see in the Picture it does not work for fast moving objects. Is there any good way to show if two points are moving towards each other?</p>
  <p><img src="https://i.stack.imgur.com/jkqXk.jpg" alt="enter image description here" /></p>