Help with implementing KeyForwardAction

I'm implementing my own version of KeyForwardAction so that it'll check for a collision, and only move forward if there is no collision.  It does stop when there is a collision, my problem is that it stops literally on the border of the box it's colliding with, so that you can see "into" the box.  I need it to stop slightly back, so that you can't see into the box when you hit it.  Does anyone know what I should be doing?



Here's my code:


public void performAction(InputActionEvent evt) {
       boolean intersects = false;
        Vector3f loc = new Vector3f ();
        loc.set(camera.getLocation());
        Platform currentPlatform;
       
        loc.addLocal(camera.getDirection ().mult(speed * evt.getTime(), tempVa));

        currentPlatform = firstPlatform;
       
      while (currentPlatform != null) {
         if (currentPlatform.box.getWorldBound ().contains (loc)) {
            intersects = true;
            break;
         }
         currentPlatform = currentPlatform.nextPlatform;
      }
      
      if (!intersects) {
         camera.setLocation(loc);
      }
      
        camera.update();
    }



Thanks!