MassFX_RBody : Modifier

MassFX_RBody - superclass: modifier; super-superclass:MAXWrapper - 54:8 - classID: #(685326, 452282)

This class implements the MassFX Rigid Body Modifier.

Available in 3ds Max 2012 and higher.

Constructor:

MassFX_RBody ...

Most of the following Properties are exposed by the MassFX_RBody modifier itself, while the Methods are exposed by the PhysXModRBInterface MixIn Interface.

"Rigid Body Properties" rollout

Properties:

<MassFX_RBody>.type     Integer    default: 1   --  integer; None

Gets/sets the state of the "Rigid Body Type" drop-down list.

Possible values are:

1 - Dynamic (default) - the Rigid Body is driven by the simulation. It is applied gravitational forces, participates in and reacts to collisions with other Rigid Bodies, and so on. Its Rigid Body Mesh cannot be concave.

2 - Kinematic - the Rigid Body is driven by pre-defined (usually keyframed) animation and can drive Dynamic Rigid Bodies, but is otherwise unaffected by the physics simulation. Its Rigid Body Mesh cannot be concave.

3 - Static - the Rigid Body is unyielding and can interact with Dynamic Rigid Bodies, but cannot be animated. Its Rigid Body Mesh can be concave.

<MassFX_RBody>.switchType     BooleanClass    default: false   --  boolean; None

Gets/sets the state of the "Until Frame" checkbox. When set to true, the type of the Rigid Body can be switched from Kinematic to Dynamic at a specified frame provided by the .switchTypeAtFrame property.

<MassFX_RBody>.switchTypeAtFrame     Integer    default: 0   --  integer; None

Gets/sets the frame on which the Rigid Body will be switched from Kinematic to Dynamic if the .switchType property is set to true.

<MassFX_RBody>.baked     Integer    default: 0   --  integer; None

Gets/sets the state of the "Bake/Unbake" button. When baked, the animation of a Dynamic Rigid Body will be converted to keyframes.

Possible values are:

0 - Unbaked - setting the property to 0 will unbake the Rigid Body and switch the button's caption to "Bake".

1 - Baked - setting the property to 1 will bake the Rigid Body and switch the button's caption to "Unbake".

<MassFX_RBody>.ContinuousCollisionDetection     BooleanClass    default: false   --  boolean; None

Gets/sets the state of the "Use High Velocity Collisions" option.

If set to true and the global High Velocity Collisions switch in the MassFX World panel is enabled, the Dynamic Rigid Body will perform continuous collision detection.

<MassFX_RBody>.SleepAtStart     BooleanClass    default: false   --  boolean; None

Gets/sets the state of the "Start In Sleep Mode" option.

When set to true, the Dynamic Rigid Body will be placed in sleep mode at the start of the simulation using the global sleep mode settings. This means that it will not move until struck by a non-sleeping Rigid Body.

<MassFX_RBody>.CollideWithRigidBodies     BooleanClass    default: true   --  boolean; None

Gets/sets the state of the "Collide With Ridig Bodies" option.

When set to true, the Rigid Body will collide with other Rigid Bodies. When set to false, the Rigid Body will not participate in collisions.

"Physical Material" rollout

Properties:

<MassFX_RBody>.density     Float    default: 0.5   --  float; None

Gets/sets the Density value of the Rigid Body. The Density is measured in grams per cubic centimeter. Changing this value automatically calculates the correct mass for the object based on its volume.

<MassFX_RBody>.mass     Float    default: 1.0   --  float; None

Gets/sets the Mass of the Rigid Body measured in kilograms.

<MassFX_RBody>.staticFriction     Float    default: 0.3   --  float; None

Gets/sets the Static Friction value of the Rigid Body's Physical Material.

Static Friction is the degree of difficulty for two Rigid Bodies to start sliding against one another. A value of 0.0 indicates no friction, a value of 1.0 indicates full friction. The effective static friction between two rigid bodies is the product of their static friction values. If one rigid body has a static friction of 0.0, the value of the other rigid body does not matter (everything slides on wet ice; even sandpaper). Once the two objects start sliding, the Dynamic Friction (see below) applies.

<MassFX_RBody>.dynamicFriction     Float    default: 0.3   --  float; None

Gets/sets the Dynamic Friction value of the Physical Material.

Dynamic Friction is the degree of difficulty for two rigid bodies to keep sliding against one another. Technically, this parameter is called the "coefficient of kinematic friction." A value of 0.0 indicates no friction, a value of 1.0 indicates full friction. In the real world, this value must be less than the coefficient of static friction - it is harder to start pushing an object than to keep it moving. As with static friction, the effective value between two rigid bodies is the product of their respective values.

<MassFX_RBody>.bounciness     Float    default: 0.5   --  float; None

Gets/sets the Bounciness value of the Rigid Body's Physical Material.

This value controls how an object bounces when it hits another rigid body. Technically, this parameter is called the "coefficient of restitution." A value of 0.0 indicates no bounce, a value of 1.0 indicates that the object will bounce off just about as hard as it hit. The effective bounciness between two rigid bodies is the product of their bounciness values.

Methods:

<boolean><MassFX_RBody>.SetRBPresetMaterial <integer>materialID

Available in 3ds Max 2013 and higher.

"Physical Shapes" rollout

Properties:

<MassFX_RBody>.meshType     Integer    default: 4   --  integer; None

Possible values are:

1 - Sphere

2 - Box

3 - Capsule

4 - Convex (default)

5 - Convex

6 - Custom

7 - Concave

<MassFX_RBody>.meshOverrideMaterial     BooleanClass    default: true   --  boolean; None; 

This property is exposed by the "Override Physical Mesh" checkbox's parameter, but must not be used.

Use the methods .GetRBMeshOverrideDriverMat() and .SetRBMeshOverrideDriverMat() documented below to get and set the Override Physical Material option per mesh.

Methods:

<integer><MassFX_RBody>.GetRBMeshCount()

Returns the number of Rigid Body Meshes.

<integer><MassFX_RBody>.AddRBMesh()

Adds a Rigid Body mesh and returns its index.

<string><MassFX_RBody>.GetRBMeshName <integer>meshIndex

Returns the Name of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshName <integer>meshIndex <string>meshName

Sets the Name of the indexed Rigid Body mesh to the string passed as second argument.

<boolean><MassFX_RBody>.DeleteRBMesh <integer>meshIndex

Deletes the indexed Rigid Body mesh.

Returns true on success, false on failure.

<boolean><MassFX_RBody>.ClipboardCopyRBMesh <integer>meshIndex

Copies the indexed Rigid Body mesh to the Clipboard.

Returns true on success, false on failure.

<boolean><MassFX_RBody>.ClipboardPasteRBMesh()

Pastes the Rigid Body mesh from the Clipboard, if available.

Returns true on success, false on failure.

<string><MassFX_RBody>.GetRBMeshType <integer>meshIndex

Returns the Type of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshType <integer>meshIndex <integer>meshType

Sets the Type of the indexed Rigid Body mesh to the integer passed as second argument.

<node><MassFX_RBody>.RBMeshConvertToCustomMesh <integer>meshIndex

Converts the indexed Rigid Body Mesh to Custom Mesh and returns it as a node.

<boolean><MassFX_RBody>.GetRBMeshOverrideDriverMat <integer>meshIndex

Returns the Override Driver Material property of the indexed Rigid Body mesh as boolean value.

Note:

Prior to 3ds Max 2022 this method was called GetRBMeshOverrideMasterMat.

<boolean><MassFX_RBody>.SetRBMeshOverrideDriverMat <integer>meshIndex <boolean>overrideIt

Sets the Override Driver Material of the indexed Rigid Body mesh to the boolean value passed as second argument.

Note:

Prior to 3ds Max 2022 this method was called SetRBMeshOverrideMasterMat.

<&matrix3><MassFX_RBody>.GetRBMeshTM <integer>meshIndex

Returns the transformation matrix of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshTM <integer>meshIndex <&matrix3>pose

pose is In and Out parameter

Sets the transformation matrix of the indexed Rigid Body mesh to the matrix3 value passed by the second by-reference argument.

<mesh><MassFX_RBody>.GetRBMeshShape <integer>meshIndex

Returns the Shape of the indexed Rigid Body mesh as a TriMesh value.

<boolean><MassFX_RBody>.SetRBMeshShape <integer>meshIndex <mesh>newMesh

Sets the Shape of the indexed Rigid Body mesh to the triMesh value passed as second argument.

<void><MassFX_RBody>.RBMeshRegenerate <integer>meshIndex

Regenerates the indexed Rigid Body Mesh.

<integer><MassFX_RBody>.GetRBMeshCompositeMeshCount <integer>meshIndex

Returns the Composite Mesh Count in the indexed Mesh of the Rigid Body.

Returns 0 if there are no composite meshes in the given mesh.

Available in 3ds Max 2013 and higher.

<boolean><MassFX_RBody>.ExtractCustomMesh()

Currently Missing Implementation .

Available in 3ds Max 2013 and higher.

<boolean><MassFX_RBody>.RBMeshCustomNodeExtract <integer>meshIndex

Extracts the indexed mesh hull for use as Custom Node.

Equivalent to pressing the "Convert To Custom Shape" button in the Physical Shapes rollout.

Available in 3ds Max 2013 and higher.

EXAMPLE:

   theTeapot = Teapot() --create a Teapot primitive
   --> $Teapot:Teapot001 @ [0.000000,0.000000,0.000000]
   theMod = MassFX_RBody() --create a MassFX Rigid Body Modifier
   --> MassFX_RBody:MassFX Rigid Body
   addModifier theTeapot theMod --add the Modifier to the Teapot
   --> OK
   theMod.RBMeshCustomNodeExtract 1 --extract the teapot hull as mesh
   --> true

"Sphere Physical Mesh Params" rollout

Properties:

<MassFX_RBody>.meshRadius     Float    default: 0.01   --  float; None

Exposes the Radius spinner's track value. The methods documented below can be used to get and set the Mesh Radius values of specific meshes.

Methods:

<float><MassFX_RBody>.GetRBMeshRadius <integer>meshIndex

Returns the Radius of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshRadius <integer>meshIndex <float>radius

Sets the Radius of the indexed Rigid Body mesh to the floating point value passed as second argument.

"Box Physical Mesh Params" rollout

Properties:

<MassFX_RBody>.meshWidth     Float    default: 0.01   --  float; None
<MassFX_RBody>.meshHeight     Float    default: 0.01   --  float; None
<MassFX_RBody>.meshLength     Float    default: 0.01   --  float; None

These properties expose the Length, Width, and Height spinners found in the UI. The methods documented below can be used for getting and setting the Length, Width, and Height of the specific meshes.

Methods:

<float><MassFX_RBody>.GetRBMeshLength <integer>meshIndex

Returns the Length of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshLength <integer>meshIndex <float>Length

Sets the Length of the indexed Rigid Body mesh to the floating point value passed as second argument.

<float><MassFX_RBody>.GetRBMeshWidth <integer>meshIndex

Returns the Width of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshWidth <integer>meshIndex <float>Width

Sets the Width of the indexed Rigid Body mesh to the floating point value passed as second argument.

<float><MassFX_RBody>.GetRBMeshHeight <integer>meshIndex

Returns the Height of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshHeight <integer>meshIndex <float>Height

Sets the Height of the indexed Rigid Body mesh to the floating point value passed as second argument.

"Capsule Physical Mesh Params" rollout

Properties:

<MassFX_RBody>.meshRadius     Float    default: 0.01   --  float; None
<MassFX_RBody>.meshHeight     Float    default: 0.01   --  float; None

"Concave Physical Mesh Params" rollout

Properties:

Methods:

"Convex Physical Mesh Params" rollout

Properties:

<MassFX_RBody>.compositeInflation     Float    default: 0.0   --  float
<MassFX_RBody>.meshConvexStyle     Integer    default: 0   --  integer; None
<MassFX_RBody>.meshVerticesLimit     Integer    default: 32   --  integer; None

Methods:

<float><MassFX_RBody>.GetRBMeshInflation <integer>meshIndex

Returns the Inflation value of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshInflation <integer>meshIndex <float>Inflation

Sets the Inflation of the indexed Rigid Body mesh to the floating point value passed as second argument.

<integer><MassFX_RBody>.GetRBMeshVertexLimit <integer>meshIndex

Returns the Vertex Limit of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshVertexLimit <integer>meshIndex <integer>VerticeLimit

Sets the Vertex Limit of the indexed Rigid Body mesh to the integer value passed as second argument.

"Composite Physical Mesh Params" rollout

Properties:

<MassFX_RBody>.compositeMaxVertices     Integer    default: 128   --  integer

Gets/sets the Maximum number of vertices in the Mesh Hull.

<MassFX_RBody>.compositeSplitLvl     Integer    default: 7   --  integer

Gets/sets the Composite Split Levels value.

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.meshInflation     Float    default: 0.0   --  float; None

Gets/sets the Inflation value.

<MassFX_RBody>.compositeSizeDiff Integer default: 90  -- integer

Gets/sets the Composite Size Difference percentage value.

Previously, exposed as .compositeSizeDifference .

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.compositeShrinkWrap     Integer    default: 90   --  integer

Gets/sets the Composite Shrink Wrap percentage value.

<MassFX_RBody>.compositeGranularity     Integer    default: 90   --  integer

Gets/sets the Composite Granularity percentage value.

<MassFX_RBody>.compositeMaxConcavity  Float default: 100.0  -- float

Gets/sets the Composite Maximum Concavity value.

Corresponds to the "Concavity" property in the Physical Mesh Parameters rollout.

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.compositeMinHulls Integer  default: 1   -- integer

Gets/sets the minimum number of composite hulls to create.

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.compositeConnDist Float  default: 0.0  --  float

Gets/sets the Composite Connection Distance value.

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.compositeControlPoints Integer  default: 1  --  integer

Gets/sets the number of Composite Control Points.

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.compositeSolidMeshes BooleanClass  default: false -- boolean

Gets/sets whether to display Solid Meshes or not.

Corresponds to the Display Solid Meshes checkbox in the UI.

Available in 3ds Max 2013 and higher.

Methods:

<boolean><MassFX_RBody>.RBMeshCompositeGenerate <integer>meshIndex

Generates the Composite Mesh of the indexed Rigid Body Mesh.

Returns true on success, false on failure.

<integer><MassFX_RBody>.GetRBMeshCompositeMeshCount <integer>meshIndex

Returns the Composite Mesh count.

<node><MassFX_RBody>.GetRBMeshCompositeMesh <integer>meshIndex <integer>index

Returns the indexed Composite Mesh specified by the second argument of the Rigid Body Mesh (specified by the first argument).

"Custom Physical Mesh Params" rollout

Methods:

<node><MassFX_RBody>.GetRBMeshCustomNode <integer>meshIndex

Returns the Custom Node of the indexed Rigid Body mesh.

<boolean><MassFX_RBody>.SetRBMeshCustomNode <integer>meshIndex <node>CustomNode

Sets the Custom Node of the indexed Rigid Body mesh to the node value passed as the second argument.

<boolean><MassFX_RBody>.ExtractCustomMesh()

Extracts the Custom Mesh.

Returns True on success, False on failure.

<boolean><MassFX_RBody>.RBMeshCustomNodeUpdateFromSource  <integer>meshIndex

Updates the indexed shape from the source object.

Equivalent to pressing the "Update From Source Object" button in the modifier's UI.

Returns True on success, False on failure.

Available in 3ds Max 2013 and higher.

"Forces" rollout

Properties:

<MassFX_RBody>.EnableGravity     BooleanClass    default: true   --  boolean; None

Gets/sets the state of the "Use Gravity" option.

If set to true and if the global Gravity switch in the MassFX World panel is enabled, the Dynamic Rigid Body will be affected by Gravity.

<MassFX_RBody>.forcesList : node array

Gets/sets the array of Force SpaceWarp objects associated with the MassFX Rigid Body simulation.

Array operations like append() and deleteItem() are supported.

Available in 3ds Max 2013 and higher.

"Advanced" rollout

Properties:

<MassFX_RBody>.EnableAdvancedSettings     Integer    default: 1   --  integer

"Simulation" group of controls

Properties:

<MassFX_RBody>.SolverIter     BooleanClass    default: false   --  boolean; None

Gets/sets the state of the "Override Solver Iterations" checkbox.

When set to False (default), the global Iterations count will be used.

When set to True, the MassFX Rigid Body modifier will use the custom number of iterations specified by the .SolverIterValue property (see below).

<MassFX_RBody>.SolverIterValue     Integer    default: 4   --  integer; None

Gets/sets the "Override Solver Iterations" value that is used when the MassFX Rigid Body Modifier's .SolverIter property (see above) is set to True.

<MassFX_RBody>.EnableBackfaceCollision : boolean

Gets/sets whether to use Backface Collision or not.

Default is false.

Available in 3ds Max 2013 and higher.

Methods:

"Contact Shell" group of controls

Properties:

Methods:

"Initial Motion" group of controls

Properties:

<MassFX_RBody>.InitialMotionStyle     Integer    default: 1   --  integer

Gets/sets the state of the Initial Motion Style radio buttons.

Possible values are:

0 - Absolute

1 - Relative

<MassFX_RBody>.InitialVelocityX     Float    default: 1.0   --  float; None
<MassFX_RBody>.InitialVelocityY     Float    default: 0.0   --  float; None
<MassFX_RBody>.InitialVelocityZ     Float    default: 0.0   --  float; None

Gets/sets the Initial Velocity X, Y, and Z values of the Rigid Body. These define the direction of the initial velocity.

<MassFX_RBody>.velocitySpeed     Float    default: 0.0   --  float; None

Gets/sets the Initial Velocity's Speed value of the Rigid Body. This defines the magnitude of the Initial Velocity.

<MassFX_RBody>.InitialSpinX     Float    default: 0.0   --  float; None
<MassFX_RBody>.InitialSpinY     Float    default: 1.0   --  float; None
<MassFX_RBody>.InitialSpinZ     Float    default: 0.0   --  float; None

Gets/sets the Initial Spin X, Y, and Z values of the Rigid Body. These define the axis of the initial spin.

<MassFX_RBody>.spinSpeed     Float    default: 0.0   --  float; None

Gets/sets the Initial Spin's Speed value of the Rigid Body.

"Center Of Mass" group of controls

Properties:

<MassFX_RBody>.MassCenterMode : integer

Gets/sets the state of the Center Of Mass radio buttons.

Valid values are:

0 - Calculate from Meshes

1 - Use Pivot

2 - Local Offset

Available in 3ds Max 2013 and higher.

<MassFX_RBody>.MassCenterX     Float    default: 0.0   --  float; None
<MassFX_RBody>.MassCenterY     Float    default: 0.0   --  float; None
<MassFX_RBody>.MassCenterZ     Float    default: 0.0   --  float; None

Gets/sets the X, Y, and Z coordinates of the Rigid Body's Center Of Mass in object space.

See the method .CalculateMassCenter() below for setting these values automatically based on the Rigid Body's meshes.

Methods:

<Point3><MassFX_RBody>.CalculateMassCenter()

Calculates the Center Of Mass and sets the properties .MassCenterX , .MassCenterY , and .MassCenterZ . Returns the result as a Point3 value.

"Damping" group of controls

Properties:

<MassFX_RBody>.LinearDamping     Float    default: 0.0   --  float; None

Gets/sets the Linear Damping value.

<MassFX_RBody>.AngularDamping     Float    default: 2.86479   --  float; None

Gets/sets the Angular Damping value.

Properties Unexposed To The UI

<MassFX_RBody>.bakeOnSimulate     BooleanClass    default: false   --  boolean
<MassFX_RBody>.extraShapes     UndefinedClass    default: undefined   --  string; None; 
<MassFX_RBody>.manualSetup     BooleanClass    default: false   --  boolean; None
<MassFX_RBody>.materialId     Integer    default: 0   --  integer; None
<MassFX_RBody>.meshCustomMesh     UndefinedClass    default: undefined   --  node; None; 
<MassFX_RBody>.SkinWidth     BooleanClass    default: false   --  boolean; None
<MassFX_RBody>.SkinWidthValue     Float    default: 1.0   --  float; None
<MassFX_RBody>.volume     Float    default: 0.0   --  float; None