Obi Official Forum
Softbody generation of proceduraly generated objects? - Printable Version

+- Obi Official Forum (https://obi.virtualmethodstudio.com/forum)
+-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html)
+--- Forum: Obi Softbody (https://obi.virtualmethodstudio.com/forum/forum-12.html)
+--- Thread: Softbody generation of proceduraly generated objects? (/thread-2846.html)



Softbody generation of proceduraly generated objects? - look001 - 06-04-2021

Hey there,
is it possible to generate a softbody from a procedural generated mesh? I have a game where the player creates a mesh and then turns it in a softbody all at runtime. It's no problem if there is a lag of 10 seconds for generating the particles and skinning the mesh. Thank you for your attention.


RE: Softbody generation of proceduraly generated objects? - josemendez - 06-04-2021

(06-04-2021, 03:50 PM)look001 Wrote: Hey there,
is it possible to generate a softbody from a procedural generated mesh? I have a game where the player creates a mesh and then turns it in a softbody all at runtime. It's no problem if there is a lag of 10 seconds for generating the particles and skinning the mesh. Thank you for your attention.

Sure, a mesh is a mesh no matter where it comes from Sonrisa.

To generate the blueprint softbody, you do this:

Code:
// create the blueprint: (ObiSoftbodySurfaceBlueprint, ObiSoftbodyVolumeBlueprint)
var blueprint = ScriptableObject.CreateInstance<ObiSoftbodySurfaceBlueprint>();

// set the blueprint's particle radius and cluster radius:
blueprint.inputMesh = yourMesh; //<----
blueprint.particleRadius = 0.05f;
blueprint.softClusterRadius = 0.1f;

// generate the blueprint:
yield return StartCoroutine(blueprint.Generate());

blueprint.Generate() is a coroutine, you can yield it or you can manually advance it if you wish. Can take a few seconds for it to be completed.

This manual page goes into details about how to create everything at runtime: solvers, actors, and blueprints:
http://obi.virtualmethodstudio.com/tutorials/scriptingactors.html

let me know if you have any questions or have trouble following it.

cheers,