[Script] Disable physics?

beastadcactus

New member
Messages
2
Reactions
0
Points
1
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