Solved Set/override Sim Texture at runtime?

Joined
Apr 11, 2025
Messages
9
Reactions
1
Hi,
I am experimenting with undressing and some clothes have a sim texture or baked sim texture of 255. I want to update this via script so right when the item should be removed it clamps it to 254 so comes freely away. I have been looking at Mxx's SimTexturePainter for inspiration, but its not obvious from the source how I would do that just at runtime (like how it works if I go into Open In Creator and hit Set Uniform Sim Texture manually).
Any tips on how to do it?
H
 
Its not exactly the same, but I found I can set the simTexture URL param to null, which has a very similar effect, at least one one or two items I tried.
 
Upvote 0
This is a theory, not tested, but give it a try:


C#:
const float FreeValue = 254f / 255f;

void FreeClothing(Atom atom)
{
    foreach (string id in atom.GetStorableIDs())
    {
        JSONStorable s = atom.GetStorableByID(id);
        if (s == null) continue;

        JSONStorableAction act = s.GetAction("SetUniformTexture");
        JSONStorableFloat val = s.GetFloatJSONParam("uniformClothSimTextureValue");
        if (act == null || val == null)
            continue;   // not a clothing item

        val.val = FreeValue;
        act.actionCallback(); // the button
    }
}
 
Upvote 0
Thanks Horing Koning, didn't think of looking for the action! Couldn't find the SetUniformTexture on any of the atom's storables atm, but I just did a quick check so might be called something else!
 
Upvote 0
Thanks Horing Koning, didn't think of looking for the action! Couldn't find the SetUniformTexture on any of the atom's storables atm, but I just did a quick check so might be called something else!
If that's not the key, add some logging in that loop and see what's available in the storables, that could expose right storable Id.

You can also take another approach and look for a known value and reverse check the key from the value. That's usually how I check what's available when I'm looking for something.

If you need I can check myself and send you the script.
 
Upvote 0
There's a plugin called Stripwise Lite that lets you adjust the sim joint strength of clothing items. You can use this to dynamically "strip" clothing off by x/y/z coordinate in a few ways, but it also has a few other options; one of the options is a slider for "Constant Multiplier", which applies a multiplier to the sim value on the clothing item. By setting the multiplier to 0.99 instead of 1.00 I was able to use it to make an item with sim values of 255 (YameteOuji's turtleneck top) fully detach. That might do the trick for your scenario.

(The issue with nulling the sim texture while in-scene is that it'll reset the clothing sim, which can sometimes cause issues or just look weird.)
 
Upvote 0
> If you need I can check myself and send you the script.

Thanks @Horing Koning! Don't worry though, sure I can find it I just need to look a little more!

> There's a plugin called Stripwise Lite

Nice, didn't know about this one, I had a look and it's really cool! (also looked at the code and wasn't aware there was a ClothSettings Component that could be found, more stuff to explore ha!)

> The issue with nulling the sim texture while in-scene is that it'll reset the clothing sim

Thanks a lot for that heads up as well @coinstacc! I set up a script to clear the simTexture in time with grabbing with a cloth sphere, and indeed it didn't work properly, like the grab just didn't take most of the time, but when I instead controlled the multiplier in StripWise it works, so seems best approach is to use StripWise, or at least Gossamer's method of controlling rigidity.
 
Upvote 0
(also looked at the code and wasn't aware there was a ClothSettings Component that could be found, more stuff to explore ha!)
Yeah I've had some fun with that myself after digging into the Stripwise code, and am still working through some of the possible applications.
 
Upvote 0
Back
Top Bottom