[devlog] Bullet SoftBody in JME3.1


#21

bravo :wink:


#22

Nice,

I kinda can see this to be used for my spaceships, on the clientside for (optional) additional details upon hit like deformation ect. :slight_smile:


#23

new little update :

i am starting to consider adding support for “cluster” based soft bodies, because it’s seem to give better performance.

I also made another video :


#24

Fantastic!

I now have a craving for gummy bears :.


#25

Just because someone asked for it : the code used in the video just above.
The softbody config is a bit different than the one used in the video but the result should be almost the same.

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.getConfig().setDynamicFrictionCoef(0.8f);
        soft.getConfig().setPoseMatchingCoef(0.2f);
  /*soft.getConfig().setClusterSoftHardness(1);
    soft.getConfig().setClusterSoftImpulseSplitCoef(0);
    soft.getConfig().setClusterKineticHardness(0.1f);
    soft.getConfig().setClusterKineticImpulseSplitCoef(1);*/
    soft.getConfig().setPositionIterations(2);    

    soft.getConfig().setCollisionsFlags(PhysicsSoftBody.Config.CL_SS + PhysicsSoftBody.Config.CL_RS);
        //soft.getConfig().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);
}

#26

It’s has been a long time without updates. Don’t worry i am still working on this as fast i can.
In the past 3 month the mains changes are :

  • fix the update of the mesh’s normals,
  • added a lot of comments and some refactor (took me a huge amout of time lol),
  • SoftBodyControl update the position of the spatial and the mesh vertice are in a local space,
  • fix creating Parallel soft bulletAppState (but do not work better),
  • added support for textured mesh (yes this was an issue).

finally i will try to make as soon as possible a nice video showing all the progress i made so far.
Stay tuned.


#27

I just released a new video that show the above improvements :


#28

Wow. Just wow. This is open source and part of jME 3.1? Brilliant… :chimpanzee_smile:


#29

5/5, but I wouldn’t use those tires anywhere. Too wobbly for my driving tastes.


#30

Just not yet a part of JME 3.1


#31

But will be soon. I’m very optimistic about that. Really nice work.
When I saw the older video where soft bodies only collided via their bounding sphere I wasn’t sure.
Now I’m totally convinced and very happy. Thank you so much. :chimpanzee_closedlaugh:


#32

this was never the case ^^
i still didn’t understand why they collides at such distances.


#33

Really amazing man ! Unbelievable ! :astonished: I love it :kissing_heart:
Thanks a lot @Dokthar .


#34

Don’t kill teh bunneh!


#35

Its awesome…


#36

But how will it do with hair and cloth?

This sucks for me, because JME3.1 has that weird bug for me. Mmmmmmm… Patience. It will be fixed.


#37

If it’s the one I’m thinking of then it was already fixed and if you built from source you could be using it already… else if it’s not already fixed then you should bump the post.


#38

hehe, yeah the only thing wrong with that is I don’t know how to build from source. Actually, I never tried in the first place so I’ll do that now and see what happens.


#39

Here you will find the instructions to compile jME from the source : How to run the 3.1 Master


#40

I tried that, but can’t at the moment because my internet is acting up. I’ll try again when I can download large files again without the connection dropping.