Beginnings of soft body physics available (Ammo plugin only) Create Soft Bodies - Babylon.js Documentation
Anchoring a cloth to a rigid body is now available Create Soft Bodies - Babylon.js Documentation
really impressive !
The possibility to use an extruded shape is amazing. Maybe could this also work with a tube ?
It would work with any shape that is built from a path, even extrudecustomshape, since the basics are
take path points and pass to Ammo as node points. Ammo updates node points, read node points from Ammo into path, update shape using path points plus parameters used to build shape. This does mean that for every execute step there is a call to the shape builder, which means the particular shape builder used has to be written into the Ammo plugin. Tube and ExtrudeCustomShape could be built in as long as the plugin had a method of distinguishing which to use. My thoughts are that ExtrudeShape is probably sufficient, however adding the rotation and scaling parameters might be fun.
This is really amazing. This looks so promising !
I like the dynamic deformations that still occur a while after the shape has landed on the box
Is it possible to pull a vertex of a softbody mesh (like a sphere) so it deforms, then springs back to shape when you let go?
Mmm good question. Don’t know off hand how you might do this or if possible. Playing around with setting and removing anchors may be worth a try. Sorry I cannot be more helpful.
What do you mean by removing anchors?
I’m thinking anchors would do the job 'cos I could attach them to vertices and pull the anchor, but as far as I know, you can only add anchors to cloth (ground) but not things like spheres.
I tried sticking an object inside the softbody and moving that object but that doesn’t work. As soon as the object is inside the other it causes a collision.
Also attaching a rope and pulling the rope, but that doesn’t deform the softbody
Sorry anchors was more of a guess than anything else and even then it would mean getting into native code. I learnt just enough about Ammo to do the basic softbody for the plugin and this was mainly through looking at existing code for Threejs. Docs for ammo are few and far between bulletjs is the best you can do. Don’t know if this might help Bullet Collision Detection & Physics Library: Class Members
Otherwise there is not much more I can add
Actually I was wrong, you can stick a mesh into a softbody. Just make the mesh a SpherebodyImposter, apply forces to it. Make sure the softbody margin is high so it doesn’t break apart.
Any chance of a simple PG example?
I’m trying to make it act like a bubble that’s being pulled.
Checking out the ammo plugin repo Babylon.js/ammoJSPlugin.ts at master · BabylonJS/Babylon.js · GitHub
I think if I can access the the soft body vertex data I can pull vertices away from the body (towards its normal) and then it’ll spring back into position. I don’t know how to do that though. That code doesn’t seem to be in the compiled ammo.js file
Several issues here.
Using the plugin the softbody node data is copied only on initialisation of the impostor The mesh vertex data copies the softbody node data each frame so amending the mesh vertex data during the render loop with have no affect on the node data and any amendment of the node data would produce a totally new softbody shape.
The compiled Ammo plugin is in https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/preview%20release/babylon.max.js
AmmoJSPlugin.prototype._createSoftbody in Babylon.max.js
EDIT IMHO you are not going to do any better than in you PG above.