*Posting here as requested. Original post is in this GitHub issue:
Making a model/mesh into a soft body when that model was imported from glTF yields some strange results. Essentially the model can’t stay stiff (it will crumple like a paper balloon when it interacts with other geometry) and when it sits on a static plane it will constantly twitch. I suspect there is something wrong with how the internal surfaces of the model are marked which causes the model to both not mark its internal areas correctly and also causes it to “collide” with itself; but I’m not actually much of a 3D engine developer so this is just my guess.
There is a sample (mostly put together by BabylonJSGuide) that can be found here: https://www.babylonjs-playground.com/#XY6QF0#4 . Despite the soft body parameters the first “pillow” shaped model that falls gets crushed under the second one and remains crushed, while the second will continue to twitch: . Removing the second model and just having the first one fall results in the same twitching. Other, more complex models seem to collapse in on a single point, or will basically “burst” and collapse into a crumple.
As this issue does not seem to appear when the model is created within BabylonJS, or when imported from some other formats (*sorry, I don’t have a list of the other formats we checked) I suspect this is something specifically related to how glTF models (and probably their internal geometry, specifically) are imported/interpreted and there is no actual problem with any of the code for soft bodies.
To me, it looks like your .glb has too many vertices to have good performances. Instead of running at 60Hz, it runs at 8-10Hz on my machine. The bigger delta time between 2 frames makes the physics engine to not compute the deformation with enough accuracy.
How many vertices do you have in the .glb compared to other formats?
Do you have another PG with other formats for comparison?
The PG posted here isn’t actually using “our” model, I think that’s just one of the generic sample models. I’m sorry to say I didn’t even put together this PG. If you check the GitHub issue the sample I/my 3D developer provided was actually using a glb export of the default Blender cube. I’m only reporting this for a developer of ours that did an evaluation and found the issue, and this developer can’t communicate in English.
To me, it looks like your .glb has too many vertices to have good performances
I think you’re probably right - I think there’s something funny with how the glTF is being interpreted and we’re getting extra vertices somewhere - and I’m guessing those extra vertices are interacting with the model in such a way that it’s basically colliding with itself and/or the area that is being calculated as internal to the soft body is not actually the internal area of the model.
How many vertices do you have in the .glb compared to other formats?
I actually don’t even know what other formats were evaluated, I only know the developer who did the evaluation said they didn’t see the problem in other formats they tried.
Good catch. So I’m guessing now strange geometry with imported glb is compounding whatever issue existed before with soft bodies. The extra “problems” exacerbated the soft body engine problem enough that we noticed it in our light testing - meaning this is likely two completely separate issues that just happen to compound.