MinieExamples/src/main/java/jme3utilities/minie/test/DropTest.java
/**
     * Callback invoked after adding a collision object to the PhysicsSpace.
     *
     * @param pco the object that was added (not null)
     */
Callback invoked after adding a collision object to the PhysicsSpace.

@param pco the object that was added (not null)
Callback invoked after adding a collision object to the PhysicsSpace . @param pco the object that was added ( not null )
@Override
    public void postAdd(PhysicsCollisionObject pco) {
        Object appData = pco.getApplicationData();
        if (appData == null) {
            ShapeGenerator random = getGenerator();
            String materialName = "drop" + random.nextInt(numDropColors);
            Material debugMaterial = findMaterial(materialName);
            assert debugMaterial != null : materialName;
            pco.setApplicationData(debugMaterial);
        }
        CollisionShape shape = pco.getCollisionShape();
        if (!pco.isStatic() && shape != null) {
            pco.setCcdMotionThreshold(5f);
            float sweptSphereRadius = shape.maxRadius();
            pco.setCcdSweptSphereRadius(sweptSphereRadius);
        }
        if (pco instanceof PhysicsRigidBody) {
            PhysicsRigidBody rigidBody = (PhysicsRigidBody) pco;
            float damping = status.damping();
            rigidBody.setDamping(damping, damping);
            rigidBody.setSleepingThresholds(0.1f, 0.1f);
        }
        if (!(shape instanceof CompoundCollisionShape)) {
            pco.setDebugMeshResolution(DebugShapeFactory.highResolution);
        }
        float friction = status.friction();
        pco.setFriction(friction);
        float restitution = status.restitution();
        pco.setRestitution(restitution);
        setDebugMaterial(pco);
    }
@ Override public void postAdd ( PhysicsCollisionObject pco ) { Object appData = pco . getApplicationData ( ) ; if ( appData == null ) { ShapeGenerator random = getGenerator ( ) ; String materialName = "drop" + random . nextInt ( numDropColors ) ; Material debugMaterial = findMaterial ( materialName ) ; assert debugMaterial != null : materialName ; pco . setApplicationData ( debugMaterial ) ; } CollisionShape shape = pco . getCollisionShape ( ) ; if ( ! pco . isStatic ( ) && shape != null ) { pco . setCcdMotionThreshold ( 5f ) ; float sweptSphereRadius = shape . maxRadius ( ) ; pco . setCcdSweptSphereRadius ( sweptSphereRadius ) ; } if ( pco instanceof PhysicsRigidBody ) { PhysicsRigidBody rigidBody = ( PhysicsRigidBody ) pco ; float damping = status . damping ( ) ; rigidBody . setDamping ( damping , damping ) ; rigidBody . setSleepingThresholds ( 0.1f , 0.1f ) ; } if ( ! ( shape instanceof CompoundCollisionShape ) ) { pco . setDebugMeshResolution ( DebugShapeFactory . highResolution ) ; } float friction = status . friction ( ) ; pco . setFriction ( friction ) ; float restitution = status . restitution ( ) ; pco . setRestitution ( restitution ) ; setDebugMaterial ( pco ) ; }
Callback invoked after adding a collision object to the PhysicsSpace.
Callback invoked after adding a collision object to the PhysicsSpace .