During gameplay, I want to know if I can swap the cloth data of an asset from one set of clothing data to another, like it’s some sort of magic cloth that changes from one set of clothing data simulating burlap to another set of clothing data representing rubber. I do not want to just change the properties because I might have painted the clothing data differently in one asset to another. Ideally, I don’t want to clone the asset and have two different copies of the same cloth, with one hidden, swapping out as needed.
Hello @pchernoff
I think I understand what you want, to have the ability to change real-time data of the Chaos Cloth (in order to modify the physics/weights without having to recreate multiple meshes) would be an interesting idea!
Before detailing the entire process or the method to achieve this, could you specify a few details for me so that I can give you the most relevant answer?
-
Unreal Version & Physics Setup
Which version of Unreal Engine are you currently using, and are you using Chaos Cloth assets or the legacy NVICloth data? -
Mesh Configuration
Is the cloth part integrated directly into the main Skeletal Mesh, or is it attached as a separate component/modular piece using the Master Pose / Set Leader Component system?
I ask because there are different ways to approach dynamically switching clothing assets, and the way you’ve approached it may have implications on how you can bind/unbind cloth physics subassets at run-time.
If you could tell me a little about how your mesh is setup, I can give you a bullet-point summary (and point you towards some relevant documentation/tutorial resources) to get you started
I doubt chaos would allow you to do this without the game crashing.
Same for nvidia but you can work around it with nvidia at least.
Just swap meshes as a whole. That’ll always work.
For the sake of clarity in this post, when talking about the Costume, I am talking about the proposed rubber mask, and when I am referring to the Clothing Data Mask or Max Distance Mask, I am referring to the “Masks” tab under the Clothing Data tab.
While swapping out the Costume is what we’re leaning right now, I do want to know if it’s possible to swap the Max Distance Masks at runtime. Right now, the idea is to animate different parts of the Costume, so depending on the situation, they have one side of the Costume is under the effect of one Max Distance Mask, and in another situation, they have a different Max Distance Mask running, which affects a different part of the Costume. However, the Costume has the same Cloth Configs.
Thanks for clarifying that. That’s helpful context for understanding the use case.
I believe that Chaos Cloth does not currently expose the ability to switch individual Max Distance Masks (or blend them together) on a single Clothing Data Asset at runtime. Vertex painted masks are baked into clothing simulation mesh data at edit time in the editor
I see a couple of ways you could tackle this depending on the look you’re going for
Multiple Clothing Assets on the Same Mesh
You can actually paint and generate two distinct Clothing Assets (ex. ClothData_StateA and ClothData_StateB) on the exact same Skeletal Mesh, each using its own set of Max Distance Masks.
Then at runtime you could try using Set Clothing Asset in Blueprints or C++ to swap between them on the Skeletal Mesh Component
Modular Skeletal Meshes/Components
Swapping out entire mesh sections or making use of modular components (as MostHost_LA pointed out above) is probably the most reliable and crash-free way to approach this inside of Chaos at the moment
Anim Dynamics/Physical Materials/World Position Offset
For animating certain aspects of local movement or deformation of the costume dynamically, driving those parameter variations through Materials or AnimDynamics/RigidBody nodes can sometimes offer significantly more nuanced dynamic control than trying to rework Chaos Cloth constraints midgame
I hope that helps you in the right direction! Let me know!
Again, even with NvCloth you would probably run into an engine crash if you were to swap the cloth definition. (what you are calling Cloth Configs)
Now, that doesn’t mean the distance is necessarily hard set, which is why I said you probably could make the engine not crash (if you built from source and corrected the different issues).
It’s not really worth the time. Make 2 assets and swap between them. Which will always work on any engine.