Spawning Particles on cloth sim - Printable Version +- Obi Official Forum (https://obi.virtualmethodstudio.com/forum) +-- Forum: Obi Users Category (https://obi.virtualmethodstudio.com/forum/forum-1.html) +--- Forum: Obi Cloth (https://obi.virtualmethodstudio.com/forum/forum-2.html) +--- Thread: Spawning Particles on cloth sim (/thread-2973.html) |
Spawning Particles on cloth sim - reuko - 08-06-2021 Hello! I'm trying to see if it's possible to spawn particles (shuriken or vfx graph) on the surface/verts of an active simulating obi cloth/skinned cloth object. The reason for this is to have a lingering dust cloud/particle trail from the movement of the cloth sim. I'm able to get the particles to spawn in editor, but when entering play mode they disappear. Is there a way to do this with any particle system setup in unity + obicloth? Thanks for your time! RE: Spawning Particles on cloth sim - josemendez - 09-06-2021 (08-06-2021, 02:53 PM)reuko Wrote: Hello! There's several ways to go about this. If you're interested in vertices/cloth particles only, one is retrieving cloth particle positions at runtime and manually emitting your shuriken particles from these positions. This works for *any* kind of Obi actor. See: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html If you want to use the mesh surface instead of individual particles, then there's two ways: -If you're using regular (non-skinned) cloth, simply use shuriken's MeshRenderer shape mode like you would with any other object. Works out of the box and it's the simplest solution for regular cloth, since it requires no scripting. -If you're using skinned cloth, you can't use shuriken's SkinnedMeshRenderer shape mode. This is because Obi bypasses SkinnedMeshRenderer, due to a limitation in how SkinnedMeshRenderers work. You can instead use Mesh shape mode, grab the cloth mesh at runtime (clothSkinnedRenderer.clothMesh), and feed it to the particle system. Here's how a simple script to do this would look like: Code: using UnityEngine; Note that you will need to position the particle system at your character's root bone, otherwise the particles will be offsetted. Here's the result (no material applied to particles, I'm just that lazy ) RE: Spawning Particles on cloth sim - reuko - 10-06-2021 Oh amazing breakdown Jose, thank you! I tried the non-skinned mesh particle setup similar to your approach here, but I'll try it again with your instructions. And i will also try the skinnedmesh approach for particle spawning as well, I'll let you know how it goes By the way, is it possible to simulate the particles from VFX graph on either static or skinned meshes? I know skinned mesh particle support was added recently in unity 2021.1 but haven't tried it yet with obi cloth RE: Spawning Particles on cloth sim - reuko - 11-06-2021 Awesome, your setup above for static and skinned mesh particle spawning seems to have done the trick! There seems to be an issue with the particles' velocity inheriting the cloth simulation motion (see dropbox link). When the skinned mesh moves around you can see that the particles move in the direction of the parent pivot, but as the cloth flings around the particles aren't following that motion, they sit in place. Is there a way to pass on the simulation motion to the inherit velocity of the dust particles? video link: https://www.dropbox.com/s/js1ro47q3ma2n2y/Recording_14%2024%2045%2006-11-2021.mp4?dl=0 Thanks again!! RE: Spawning Particles on cloth sim - josemendez - 11-06-2021 (11-06-2021, 04:12 PM)reuko Wrote: Awesome, your setup above for static and skinned mesh particle spawning seems to have done the trick! Hi Reuko, Shuriken particles inherit the velocity of the mesh, as a whole. They get it from differences in the transform position (something along the lines of: Code: velocity = (meshRenderer.transform.position - old position) / Time.deltaTime; However Shuriken knows nothing about cloth simulation, so it does not consider individual cloth particle velocities. This is something you'll have to implement yourself. Obi lets you retrieve any property of each individual cloth particle, including its velocity. See: http://obi.virtualmethodstudio.com/tutorials/scriptingparticles.html Using that, you can determine the barycentric coordinates of each Shuriken particle when it is spawned, grab the velocity of the 3 corresponding cloth particles, and interpolate a velocity value for the Shuriken particle. RE: Spawning Particles on cloth sim - josemendez - 11-06-2021 (10-06-2021, 12:03 PM)reuko Wrote: By the way, is it possible to simulate the particles from VFX graph on either static or skinned meshes? I know skinned mesh particle support was added recently in unity 2021.1 but haven't tried it yet with obi cloth No idea, haven't touched VFX graph. My guess is that if it has support for skinned meshes/meshes, the setup will be similar to the ones I outlined in my first post. RE: Spawning Particles on cloth sim - reuko - 21-06-2021 Thanks again for the detailed reply Jose! I'll be looking into the cloth simulation velocity inheritance this week, I'll let you know how it goes! Much love |