Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Softbody Update
#7
(14-12-2023, 12:04 PM)josemendez Wrote: Could you elaborate a bit? Do you mean a label that shows the amount of particles in the blueprint?
If so, a simple workaround is to hit the "invert selection" button in blueprint edit mode to select all particles, then look at the amount of selected particles. But yeah, we can add an info field with the amount of particles.
Exactly! I added an 'Int' simply for convenience, mainly because I was trying to find a configuration that gave me the best balance between performance and visuals.

On the other hand, I've been trying to generate everything at runtime like my original code. I noticed that the method for binding has changed, and i cant make it work correctly. (I initially deactivate the game object with the skinned mesh, add the soft body component and the skinner, and then reactivate the game object and make it a child of the solver). In the previous version, it worked without any problems. Am I missing something? Or perhaps it's no longer possible to generate them at runtime?"


Code:
var Skinner = SkinnedMesh.gameObject.AddComponent<ObiSoftbodySkinner>();
        var SoftBody = SkinnedMesh.gameObject.AddComponent<ObiSoftbody>();
        var Blueprint = ScriptableObject.CreateInstance<ObiSoftbodySurfaceBlueprint>();
        Blueprint.inputMesh = SkinnedMesh.sharedMesh;
        Blueprint.skeleton = SkinnedMesh.rootBone.gameObject;
        Blueprint.rootBone = SkinnedMesh.rootBone;
        Blueprint.surfaceResolution = SurfaceResolution;
        Blueprint.surfaceSamplingMode = SurfaceMode;
        Blueprint.volumeResolution = VolumeResolution;
        Blueprint.volumeSamplingMode = VolumeMode;
        Blueprint.GenerateImmediate();
        SoftBody.softbodyBlueprint = Blueprint;
        Skinner.softbody = SoftBody;
        Skinner.customSkinMap = Blueprint.defaultSkinmap;
        Skinner.Bind();
       


If I add the Particle Renderer, I can see that the particles are generated correctly and deform properly when moving the bones. However, the mesh glitch completely, so I assume I'm missing something when I do the binding or maybe the skinmap?.
Reply


Messages In This Thread
Softbody Update - by SimonP - 13-12-2023, 01:14 PM
RE: Softbody Update - by josemendez - 13-12-2023, 01:22 PM
RE: Softbody Update - by SimonP - 13-12-2023, 06:22 PM
RE: Softbody Update - by josemendez - 14-12-2023, 11:22 AM
RE: Softbody Update - by SimonP - 14-12-2023, 11:46 AM
RE: Softbody Update - by josemendez - 14-12-2023, 12:04 PM
RE: Softbody Update - by SimonP - 15-12-2023, 08:09 PM
RE: Softbody Update - by SimonP - 16-12-2023, 07:17 PM