09-10-2018, 08:57 AM
(This post was last modified: 09-10-2018, 08:58 AM by josemendez.)
(09-10-2018, 08:35 AM)arrnav96 Wrote: Hi,
I would like to know how to add a particle system to an existing cloth object.
For instance, if I have a cloth dynamically changing it's mesh shape, I would like to add a particle system on top of it which also follows the shape of the cloth mesh. Think of bubbles on top of a water surface.
I've tried using unity's skinned mesh bake option and updating particle system input mesh according to it, but that exists only for skinned mesh renderers. I know I can use a custom shader or complex decal assets for this, but as I'm unfamiliar with shader coding and would like to keep things simple, I would like to know if there's any existing way to utilize via this asset.
Thanks.
Being a cloth simulator, Obi does not provide any way to deal with this.
You will have to code your own solution. The simplest thing that comes to mind is using barycentric coordinates to store each particle's position relative to its closest triangle, and update them as the mesh deforms. You can get the deformed cloth mesh each frame like this:
Code:
obiClothComponent.clothMesh
cheers,