MinieExamples/src/main/java/jme3utilities/minie/test/TestSoftBody.java
/**
     * Add a squishy ball to the scene.
     */
Add a squishy ball to the scene.
Add a squishy ball to the scene .
private void addSquishyBall(float startY) {
        int numRefinementIterations = 3;
        float radius = 0.5f;
        Mesh mesh = new Icosphere(numRefinementIterations, radius);
        PhysicsSoftBody ballPsb = new PhysicsSoftBody();
        NativeSoftBodyUtil.appendFromTriMesh(mesh, ballPsb);
        ballPsb.setMass(mass);
        SoftBodyConfig config = ballPsb.getSoftConfig();
        config.set(Sbcp.PoseMatching, 0.02f);
        config.set(Sbcp.KineticHardness, 1f);
        boolean setVolumePose = false;
        boolean setFramePose = true;
        ballPsb.setPose(setVolumePose, setFramePose);
        Material pinkMaterial = findMaterial("pink");
        ballPsb.setDebugMaterial(pinkMaterial);
        ballPsb.setDebugMeshNormals(DebugMeshNormals.Smooth);
        Vector3f translation = new Vector3f(0f, startY, 0f);
        ballPsb.applyTranslation(translation);
        physicsSpace.addCollisionObject(ballPsb);
    }
private void addSquishyBall ( float startY ) { int numRefinementIterations = 3 ; float radius = 0.5f ; Mesh mesh = new Icosphere ( numRefinementIterations , radius ) ; PhysicsSoftBody ballPsb = new PhysicsSoftBody ( ) ; NativeSoftBodyUtil . appendFromTriMesh ( mesh , ballPsb ) ; ballPsb . setMass ( mass ) ; SoftBodyConfig config = ballPsb . getSoftConfig ( ) ; config . set ( Sbcp . PoseMatching , 0.02f ) ; config . set ( Sbcp . KineticHardness , 1f ) ; boolean setVolumePose = false ; boolean setFramePose = true ; ballPsb . setPose ( setVolumePose , setFramePose ) ; Material pinkMaterial = findMaterial ( "pink" ) ; ballPsb . setDebugMaterial ( pinkMaterial ) ; ballPsb . setDebugMeshNormals ( DebugMeshNormals . Smooth ) ; Vector3f translation = new Vector3f ( 0f , startY , 0f ) ; ballPsb . applyTranslation ( translation ) ; physicsSpace . addCollisionObject ( ballPsb ) ; }
Add a squishy ball to the scene.
Add a squishy ball to the scene .