MinieExamples/src/main/java/jme3utilities/minie/test/DropTest.java
/**
     * Add a drop (dynamic body) to the PhysicsSpace. Note: recursive.
     *
     * @param numTries the number of attempts to make before giving up (&gt;0)
     * @return true if successful, otherwise false
     */
Add a drop (dynamic body) to the PhysicsSpace. Note: recursive.

@param numTries the number of attempts to make before giving up (>0)
@return true if successful, otherwise false
Add a drop ( dynamic body ) to the PhysicsSpace . Note : recursive . @param numTries the number of attempts to make before giving up ( > 0 ) @return true if successful otherwise false
private boolean addADrop(int numTries) {
        if (countDrops() >= maxNumDrops) {
            return false; 
        }
        ShapeGenerator random = getGenerator();
        Vector3f startLocation = random.nextVector3f(); 
        startLocation.multLocal(2.5f, 5f, 2.5f);
        startLocation.y += 20f;
        Quaternion startOrientation = random.nextQuaternion(); 
        Transform startPosition
                = new Transform(startLocation, startOrientation); 
        String typeName = status.nextDropType();
        float totalMass = 1f;
        Drop drop = new Drop(this, typeName, totalMass, startPosition);
        if (drop.hasDac() || !drop.hasHullContacts()) {
            drop.addToSpace();
            drops.addLast(drop);
            return true;
        } else if (numTries > 1) { 
            boolean result = addADrop(numTries - 1);
            return result;
        }
        return false;
    }
private boolean addADrop ( int numTries ) { if ( countDrops ( ) >= maxNumDrops ) { return false ; } ShapeGenerator random = getGenerator ( ) ; Vector3f startLocation = random . nextVector3f ( ) ; startLocation . multLocal ( 2.5f , 5f , 2.5f ) ; startLocation . y += 20f ; Quaternion startOrientation = random . nextQuaternion ( ) ; Transform startPosition = new Transform ( startLocation , startOrientation ) ; String typeName = status . nextDropType ( ) ; float totalMass = 1f ; Drop drop = new Drop ( this , typeName , totalMass , startPosition ) ; if ( drop . hasDac ( ) || ! drop . hasHullContacts ( ) ) { drop . addToSpace ( ) ; drops . addLast ( drop ) ; return true ; } else if ( numTries > 1 ) { boolean result = addADrop ( numTries - 1 ) ; return result ; } return false ; }
Add a drop (dynamic body) to the PhysicsSpace.
Add a drop ( dynamic body ) to the PhysicsSpace .
// too many drops
 //TODO garbage
 //TODO garbage
 //TODO garbage
 // try again
