Hello monkeys,
I started working on SoftBody so you don’t have to .
I already have been into this development for about a huge month. Learning how to make a JNI wrapping, learning the Bullet library, building & testing ect …
Since SoftBody features isn’t available in jBullet but only into the native C/C++ Bullet. These features will only be available using the jme3-bullet-native & jme3-bullet libraries.
At this point SoftBodies are getting somewhere (good to know). The very basics bindings are working, but this still a lot of WIP features. You can create a PhysicsSoftBody and add this into a BulletSoftBodyAppState (as adding a PhysicsRigidBody into the BulletAppState). One of the only working (and tested) way to create a SoftBody is to use the constructor with a given Mesh. (Note that only mesh with a triangles faces will work )
You can find the working fork here : GitHub - dokthar/jmonkeyengine: A complete 3D game development suite written purely in Java.
More informations can be found on the wiki page, which is still in early writing stage, so feel free to add your tips.
GETTING STARTED
I do not distribute the dynamics lib (.so / .dll …) so you have to checkout the whole project from GitHub then build the project for your platform.
- checkout the project from GitHub.
- go into the file gradle.propeties and set the line : buildNativeProjecte = true .
- run the command : ./gradlew build
- then run the command to build the sdk : ant -f ./sdk/ build-zip
- create a new project and make sure you use the following libraries : jme3-bullet-native and jme3-bullet (instead of jme3-jBullet)
EXAMPLE
public void simpleInitApp() {
softBodyAppState = new BulletSoftBodyAppState();
getStateManager().attach(softBodyAppState);
SoftBodyWorldInfo sbwi = softBodyAppState.getPhysicsSoftSpace().getWorldInfo();
sbwi.setGravity(Vector3f.UNIT_Y.mult(-0.981f));
//start addSoftBunny();
Material matN = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
Geometry bunny = new Geometry("b", StandfordBunny.getMesh().deepClone());
bunny.setMaterial(matN);
rootNode.attachChild(bunny);
bunny.addControl(new SoftBodyControl(false));
PhysicsSoftBody soft = bunny.getControl(SoftBodyControl.class);
soft.generateClusters(8);
soft.config().setDynamicFrictionCoef(0.8f);
soft.config().setPoseMatchingCoef(0.2f);
/*soft.config().setClusterSoftHardness(1);
soft.config().setClusterSoftImpulseSplitCoef(0);
soft.config().setClusterKineticHardness(0.1f);
soft.config().setClusterKineticImpulseSplitCoef(1);*/
soft.config().setPositionIterations(2);
soft.config().setCollisionsFlags(PhysicsSoftBody.Config.CL_SS + PhysicsSoftBody.Config.CL_RS);
//soft.config().setCollisionsFlags(PhysicsSoftBody.Config.VF_SS+PhysicsSoftBody.Config.Default);
soft.setPose(false, true);
soft.setTotalMass(100, true);
soft.randomizeConstraints();
softBodyAppState.getPhysicsSoftSpace().add(soft);
// end addSoftBunny();
Box floorMesh = new Box(100f, 0.5f, 100f);
Geometry floor = new Geometry("floor", floorMesh);
floor.move(0, -5f, 0);
floor.addControl(new RigidBodyControl(0));
softBodyAppState.getPhysicsSpace().add(floor);
}
TODO
You can find the updated todo list on github