Go to: Synopsis. Return value. Related. Flags. MEL examples.

Synopsis

collision [-friction float] [-name string] [-offset float] [-resilience float] [objects]

collision is undoable, queryable, and editable.

For each listed object, the command creates a new field. The field has a shape which lives in the DAG and it has an associated dependency node. The field is added to the list of fields owned by the object. Use connectDynamic to cause the field to affect a dynamic object. Note that if more than one object is listed, a separate field is created for each object.

If fields are created, this command returns the names of each owning shape and of the field shapes themselves. If a field was queried, the results of the query are returned. If a field was edited, the field name is returned.

If no object names are provided but the active selection list is non-empty, the command creates a field for every object in the list. If the list is empty, the command defaults to -pos 0 0 0. 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:

Return value

string[]Geometry names that were setup for particle collision.

In query mode, return type is based on queried flag.

Related

event, particle

Flags

friction, name, offset, resilience
Long name (short name) Argument types Properties
-friction(-f) float queryedit
Friction of the surface. This is the amount of the colliding particle's velocity parallel to the surface which is removed when the particle collides. A value of 0 will mean that no tangential velocity is lost, while a value of 1 will cause the particle to reflect straight along the normal of the surface.
-name(-n) string queryedit
name of field
-offset(-o) float queryedit
Offset value for the connector.
-resilience(-r) float queryedit
Resilience of the surface. This is the amount of the colliding particle's velocity reflected along the normal of the surface. A value of 1 will give perfect reflection, while a value of 0 will have no reflection along the normal of the surface.

Flag can appear in Create mode of command Flag can appear in Edit mode of command
Flag can appear in Query mode of command Flag can be used more than once in a command.

MEL examples

collision -r .75 -f .1  nurbsSphere1 particle1;
// 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.

collision -q -f nurbsSphere1;
// Returns the friction value stored in the geoConnector for nurbsSphere1.

collision -q -f nurbsSphere1 particleShape1;
// 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.

collision -q nurbsSphere1 particleShape1;
// Returns whether or not particleShape1 is checking for collisions
// against nurbsSphere1.

collision -q particleShape1;
// Returns all of the geometries that particleShape1 is colliding with.