Obi Official Forum
Help The skin backstop changes made through the script are not reflected on the screen. - 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: Help The skin backstop changes made through the script are not reflected on the screen. (/thread-4176.html)



The skin backstop changes made through the script are not reflected on the screen. - ziziza93 - 17-04-2024

Hello,
I changed the skin backstop value in the blueprint to -0.05 and then back to 0 after 3 seconds.

After running the script, I checked with blueprint edit and the value has changed, but it is not reflected on the screen.
Do I need to run the updater separately?

Code:
        var skinnedCloth = clothInstance.GetComponent<ObiSkinnedCloth>();
        var constraints = skinnedCloth.GetConstraintsByType(Oni.ConstraintType.Skin)
            as ObiConstraints<ObiSkinConstraintsBatch>;
        var skinBatch = constraints.batches[0];
        for (var i = 0; i < skinBatch.activeConstraintCount; ++i)
        {
            skinBatch.skinRadiiBackstop[i * 3 + 2] = -0.05f; // backstop sphere distance
        }
        await Task.Delay(3000);
        for (var i = 0; i < skinBatch.activeConstraintCount; ++i)
        {
            skinBatch.skinRadiiBackstop[i * 3 + 2] = 0;    // backstop sphere distance
        }



RE: The skin backstop changes made through the script are not reflected on the screen. - josemendez - 17-04-2024

Hi,

You're changing the blueprint, this will only affect actors that instantiate that blueprint's data from that point on. It will not affect actors that have already been instantiated into a solver. For details on how Obi's architecture works, see:
http://obi.virtualmethodstudio.com/manual/6.3/bigpicture.html

Quote:Whenever a new actor is added to a solver, these steps take place:

[...]The actor makes a copy of all constraints found in the blueprint, and updates their particle references so that they point to the correct solver array positions.[...]

If you want the changes made to constraints to affect an already existing actor, you must modify the solver's constraints directly. See the manual for details and sample code:
http://obi.virtualmethodstudio.com/manual/6.3/scriptingconstraints.html

kind regards,