pymel.core.effects.rigidSolver

rigidSolver(*args, **kwargs)

This command sets the attributes for the rigid solver In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
autoTolerances (at) bool ../../../_images/query.gif ../../../_images/edit.gif
 

Turns the auto tolerance calculation on and off. The auto tolerances calculation will override the default or user defined values of the step size and collision tolerance value that is calculated based on the objects in the scene. Default: 0 (off)

bounciness (b) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns bounciness on and off for the an the objects in the simulation. Default value: on
cacheData (cd) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns the cache on fall all rigid bodies in the system. Default value: off
collide (c) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Disallows the interpenetration of the two rigid bodies listed. Default: Collide is on for all bodies.
collisionTolerance (ct) float ../../../_images/query.gif ../../../_images/edit.gif
 
Sets the collision tolerance. This is the error at which two objects are considered to have collided. Range: 0.0005 - 1.000 Default: 0.02
contactData (ctd) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns the contact data information on/off for all rigid bodies. Default value: off
create (cr) bool ../../../_images/create.gif
 
Creates a new rigid solver.
current (cu) bool ../../../_images/create.gif
 
Sets rigid solver as the current solver.
deleteCache (deleteCache) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Deletes the cache for all rigid bodies in the system.
displayCenterOfMass (dcm) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Displays the center of mass icon. Default value: on
displayConstraint (dc) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Displays the constraint vectors. Default value: on
displayVelocity (dv) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Displays the velocity vectors. Default value: off
dynamics (d) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns dynamics on and off for the an the objects in the simulation. Default value: on
friction (f) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns friction on and off for the an the objects in the simulation. Default value: on
interpenetrate (i) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Allows the two rigid bodies listed to interpenetrate. Default: interpenetration is off for all bodies.
interpenetrationCheck (ic) bool ../../../_images/edit.gif
 
Checks for interpenetrating rigid bodies in the scene.
name (n) unicode  
   
rigidBodies (rb) bool ../../../_images/query.gif
 
Returns a list of rigid bodies in the solver.
rigidBodyCount (rbc) bool ../../../_images/query.gif
 
Returns the number of rigid bodies in the solver.Flag can appear in Create mode of commandFlag can have multiple arguments, passed either as a tuple or a list.
showCollision (sc) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Displays the colliding objects in a different color.
showInterpenetration (si) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Displays the interpenetrating objects in a different color.
solverMethod (sm) int ../../../_images/query.gif ../../../_images/edit.gif
 

Sets the solver method. The choices are 0 | 1 | 2. 0 = Euler (fastest/least acurate), 1 = Runge-Kutta ( slower/more acurate), 2 = adaptive Runge-Kutta (slowest/most acurate). The default is 2 (adaptive Runge-Kutta)

startTime (stt) float ../../../_images/create.gif ../../../_images/query.gif ../../../_images/edit.gif
 
Sets the start time for the solver.
state (st) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns the rigid solver on or off.
statistics (sta) bool ../../../_images/query.gif ../../../_images/edit.gif
 
Turns the statistic information on/off for all rigid bodies. Default value: off
stepSize (s) float ../../../_images/query.gif ../../../_images/edit.gif
 
Sets the solvers step size. This is the maximum size of a single step the solver will take at one time. Range: 0.0004 - 0.100 Default: 0.0333
velocityVectorScale (vs) float ../../../_images/query.gif ../../../_images/edit.gif
 
scales the velocity vector display. Default value: 1.0

Derived from mel command maya.cmds.rigidSolver

Example:

import pymel.core as pm

# Set the playback time range to [1, 100]
pm.playbackOptions(min=1, max=100)
# Result: 1.0 #
# Create a poly cube named "floor"
pm.polyCube(w=10, h=0.10, d=10, sx=10, sy=1, sz=10, ax=(0, 1, 0), name='floor')
# Result: [nt.Transform(u'floor'), nt.PolyCube(u'polyCube1')] #
# Create a poly sphere named "ball", then move it to 0 9 0
pm.polySphere(r=1, sx=20, sy=20, ax=(0, 1, 0), name='ball')
# Result: [nt.Transform(u'ball'), nt.PolySphere(u'polySphere1')] #
pm.move(0, 9.0, 0, r=True)
# Create a new rigid body solver
pm.rigidSolver(create=True, name='rigidSolver1')
# Result: nt.RigidSolver(u'rigidSolver1') #
# Set the floor to passive rigid body
pm.select('floor')
pm.rigidBody(passive=True, solver='rigidSolver1', name='passiveRigidBody')
# Result: nt.RigidBody(u'passiveRigidBody') #
# Set the ball to active rigid body
pm.select('ball')
pm.rigidBody(active=True, solver='rigidSolver1', name='activeRigidBody')
# Result: nt.RigidBody(u'activeRigidBody') #
# Add a gravity field, and connect it to ball
pm.gravity(pos=(0, 0, 0), m=9.8, dx=0, dy=-1, dz=0, name='gravityField')
# Result: nt.GravityField(u'gravityField') #
pm.connectDynamic('activeRigidBody', f='gravityField')
# Result: [u'activeRigidBody'] #
# Play
pm.play(w=True)

# Set the rigid solver to allow the ball to interpenetrate the floor, then replay
pm.currentTime(1, e=True)
# Result: 1.0 #
pm.rigidSolver('passiveRigidBody', 'activeRigidBody', 'rigidSolver1', e=True, interpenetrate=True)
# Result: nt.RigidSolver(u'rigidSolver1') #
pm.play(w=True)

# Set the rigid solver to disallow the ball to interpenetrate the floor, replay
pm.currentTime(1, e=True)
# Result: 1.0 #
pm.rigidSolver('passiveRigidBody', 'activeRigidBody', 'rigidSolver1', e=True, collide=True)
# Result: nt.RigidSolver(u'rigidSolver1') #
pm.play(w=True)

# Set the rigid solver to turn off the bounciness, replay
pm.currentTime(1, e=True)
# Result: 1.0 #
pm.rigidSolver('rigidSolver1', e=True, bounciness=False)
# Result: nt.RigidSolver(u'rigidSolver1') #
pm.play(w=True)

Previous topic

pymel.core.effects.rigidBody

Next topic

pymel.core.effects.runup

Core

Core Modules

Other Modules

This Page