MinieExamples/src/main/java/jme3utilities/minie/test/DropTest.java
/**
     * Add a hexagonal trampoline to the PhysicsSpace, to serve as a platform.
     *
     * @param y the initial Y coordinate
     */
Add a hexagonal trampoline to the PhysicsSpace, to serve as a platform.

@param y the initial Y coordinate
Add a hexagonal trampoline to the PhysicsSpace to serve as a platform . @param y the initial Y coordinate
private void addTrampoline(float y) {
        int numRings = 9;
        float vertexSpacing = 2f;
        Mesh mesh = new ClothHexagon(numRings, vertexSpacing);
        PhysicsSoftBody softBody = new PhysicsSoftBody();
        NativeSoftBodyUtil.appendFromTriMesh(mesh, softBody);
        softBody.applyTranslation(new Vector3f(0f, y, 0f));
        /*
         * Pin every node on the perimeter.
         */
        int numNodes = mesh.getVertexCount();
        int numInteriorNodes = 1 + 3 * numRings * (numRings - 1);
        for (int nodeI = numInteriorNodes; nodeI < numNodes; ++nodeI) {
            softBody.setNodeMass(nodeI, PhysicsBody.massForStatic);
        }
        softBody.setDebugMeshNormals(DebugMeshNormals.Smooth);
        softBody.setMargin(1f);
        softBody.setMass(100f);
        SoftBodyConfig config = softBody.getSoftConfig();
        config.setCollisionFlags(ConfigFlag.SDF_RS, ConfigFlag.VF_SS);
        config.setPositionIterations(3);
        addPlatform(softBody);
    }
private void addTrampoline ( float y ) { int numRings = 9 ; float vertexSpacing = 2f ; Mesh mesh = new ClothHexagon ( numRings , vertexSpacing ) ; PhysicsSoftBody softBody = new PhysicsSoftBody ( ) ; NativeSoftBodyUtil . appendFromTriMesh ( mesh , softBody ) ; softBody . applyTranslation ( new Vector3f ( 0f , y , 0f ) ) ; /*
         * Pin every node on the perimeter.
         */ int numNodes = mesh . getVertexCount ( ) ; int numInteriorNodes = 1 + 3 * numRings * ( numRings - 1 ) ; for ( int nodeI = numInteriorNodes ; nodeI < numNodes ; ++ nodeI ) { softBody . setNodeMass ( nodeI , PhysicsBody . massForStatic ) ; } softBody . setDebugMeshNormals ( DebugMeshNormals . Smooth ) ; softBody . setMargin ( 1f ) ; softBody . setMass ( 100f ) ; SoftBodyConfig config = softBody . getSoftConfig ( ) ; config . setCollisionFlags ( ConfigFlag . SDF_RS , ConfigFlag . VF_SS ) ; config . setPositionIterations ( 3 ) ; addPlatform ( softBody ) ; }
Add a hexagonal trampoline to the PhysicsSpace, to serve as a platform.
Add a hexagonal trampoline to the PhysicsSpace to serve as a platform .