Go to: Synopsis. Return value. Related. Flags. Python examples.
collision(
[objects]
, [friction=float], [name=string], [resilience=float])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
collision is undoable, queryable, and editable.
The collision command causes particles to collide with geometry. It also allows you to specify values for the surface properties (friction and resilience) of the collision. These values are stored in the geoConnector node for the geometry object. Unlike earlier versions of Maya, there is no separate "collision node."If a soft object is in the selection list, the collision command assumes that you want to make it a collider. In order to make the soft object collide with something use, use connectDynamic -c. The collision menu option sorts this out using the lead object rule and issues the necessary commands. On creation, this command returns a string array of the geometry names that were setup for particle collision.
When the command is used to query information, there are several possible return types. These include:
...where the number following the ":" is the multiIndex.
string[] | Geometry names that were setup for particle collision. |
In query mode, return type is based on queried flag.
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
friction(f)
|
float
|
![]() ![]() |
||
|
||||
name(n)
|
string
|
|||
|
||||
resilience(r)
|
float
|
![]() ![]() |
||
|
![]() |
![]() |
![]() |
![]() |
import maya.cmds as cmds cmds.collision( 'nurbsSphere1', 'particle1', r=.75, f=.1 ) # Causes particles of particle1 to collide with nurbsSphere1, # and sets a resilience value of 0.75 and a friction value of 0.1 # for the surface. cmds.collision( 'nurbsSphere1', q=True, f=1 ) # Returns the friction value stored in the geoConnector for nurbsSphere1. cmds.collision( 'particleShape1', 'nurbsSphere1', q=True, f=1 ) # Returns the friction value that particleShape1 is using for collisions # against nurbsSphere1. This may be the same as the friction stored in # nurbsSphere1's geoConnector. Or, if the user broke that connection, # then it is whatever value is in the particleShape1's collisionFriction # attribute that is used for collision with nurbsSphere1. cmds.collision( 'nurbsSphere1', 'particleShape1', q=True ) # Returns whether or not particleShape1 is checking for collisions # against nurbsSphere1. cmds.collision( 'particleShape1', q=True ) # Returns all of the geometries that particleShape1 is colliding with.