Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Softbody generation of proceduraly generated objects?
#1
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.
Reply
#2
(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/tutor...ctors.html

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

cheers,
Reply