• Hi Guest!

    We are extremely excited to announce the release of our first Beta1.1 and the first release of our Public AddonKit!
    To participate in the Beta, a subscription to the Entertainer or Creator Tier is required. For access to the Public AddonKit you must be a Creator tier member. Once subscribed, download instructions can be found here.

    Click here for information and guides regarding the VaM2 beta. Join our Discord server for more announcements and community discussion about VaM2.
  • Hi Guest!

    VaM2 Resource Categories have now been added to the Hub! For information on posting VaM2 resources and details about VaM2 related changes to our Community Forums, please see our official announcement here.

[Script] Disable physics?

beastadcactus

New member
Joined
Oct 29, 2020
Messages
2
Reactions
0
Is it possible to do the same thing as the physics object>physics button does via script, given an atom?
I'm writing a script that's meant to create some atoms and I'd like to disable physics at least, ideally copy the physics and collision states from a given (source) atom.
 
You can do that with triggers no problem in the physics category : )

And through script, you can do whatever the frak you want by using the storables.
Example for controlling the global lighting:

C#:
SuperController.singleton.GetAtomByUid("CoreControl").GetStorableByID("GlobalLighting").GetFloatParamValue("camExposure");
SuperController.singleton.GetAtomByUid("CoreControl").GetStorableByID("GlobalLighting").SetFloatParamValue("camExposure",1f);

In the end, your process is: modify a scene > modify settings> save scene > look at json what are the ids > get the storable through code and edit them.
 
Just implements as hazmhox said.
If I explain a little more, for example Person
Snap1.jpg

The three checkboxes above correspond to each code.
C#:
static void setPersonPhysics(Atom atom, bool v)
{// is person only
    if (atom == null || atom.category != "People") return;
    DAZCharacterSelector dazc = atom.GetStorableByID("geometry") as DAZCharacterSelector;
    atom.collisionEnabled = v;
    dazc.GetBoolJSONParam("useAdvancedColliders").val = v;
    atom.GetStorableByID("SoftBodyPhysicsEnabler").GetBoolJSONParam("enabled").val = v;
}
 
Last edited:
Back
Top Bottom