VaM 1.x Set/override Sim Texture at runtime?

Threads regarding the original VaM 1.x
Joined
Apr 11, 2025
Messages
8
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
Back
Top Bottom