- Main Page
- Related Pages
- Modules
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Friends

# MnParticle Class Reference

# OpenMayaFX - API module for effects

Search for all occurrences

## Detailed Description

Class for wrapping N cloth objects.

This class wraps the internal Maya representation of N cloth objects suitable for use with the Nucleus solver.

`#include <MnParticle.h>`

Inheritance diagram for MnParticle:
[legend]

List of all members.

## Public Member Functions
| MnParticle ()
| Default constructor.
virtual | ~MnParticle ()
| The class destructor.
MStatus | createNParticle ()
| Creates the underlying Maya TnParticle and sets this class to wrap it.
MStatus | setTopology (const int numPoints)
| Sets the topology of the underlying N Object.
MStatus | setPositions (const MFloatPointArray &positions, bool startFrame=true)
| Sets the positions of the vertices of the underlying N cloth object.
MStatus | setVelocities (const MFloatPointArray &velocities)
| Sets the velocities of the vertices of the underlying Ncloth object.
MStatus | setThickness (float radius)
| sets a radius on each point collision purposes.
MStatus | setThickness (float *radius)
| sets a radius (thickness) on a per point basis for collision purposes.
MStatus | setInverseMass (float invMass)
| sets the mass for every point in this mesh
MStatus | setInverseMass (float *invMass)
| sets the mass on a per point basis
MStatus | setBounce (float bounce)
| sets the bounce for every point in this mesh
MStatus | setBounce (float *bounce)
| sets the bounce on a per point basis in this mesh
MStatus | setFriction (float friction)
| sets the friction for every point in this mesh
MStatus | setFriction (float *friction)
| sets the friction on a per point basis for this mesh
MStatus | setDamping (float damping)
| sets the damping for every point in this mesh
MStatus | setDamping (float *damping)
| sets the damping on a per point basis in this mesh
MStatus | setDisableGravity (const bool b)
| Sets whether gravity will affect this object.
MStatus | setLiquidSimulation (const bool b)
| Sets whether this object will solve as a liquid.
MStatus | setIncompressibility (float incompressibility)
| sets the incompressibility
MStatus | setRestDensity (float restDensity)
| sets the rest density for every point in this mesh
MStatus | setLiquidRadiusScale (float liquidRadiusScale)
| sets the liquidRadiusScale for every point in this mesh
MStatus | setViscosity (float viscosity)
| sets the viscosity for every point in this mesh
MStatus | setViscosity (float *viscosity)
| sets the viscosity on a per point basis in this mesh
MStatus | setSurfaceTension (float surfaceTension)
| sets the surfaceTension for every point in this mesh
MStatus | setSurfaceTension (float *surfaceTension)
| sets the surfaceTension on a per point basis in this mesh
MStatus | setMaxIterations (const int it)
| Sets the number of iterations the solver will perform on various dynamic properties like drag, damping, stretch and bend.
MStatus | setMaxSelfCollisionIterations (const int it)
| Sets the number of iterations the solver will perform for self collisions on this object.
MStatus | setSelfCollisionSoftness (float softness)
| This allows one to lower the repulsive force of self collisions such that some interpenetration within the collide width is allowed.
MStatus | setDragAndLift (float drag, float lift)
| Sets the drag and lift values for the cloth.
MStatus | setCollide (const bool b)
| Sets whether collisions will affect this object.
MStatus | setSelfCollide (const bool b)
| Sets whether self collisions will affect this object.
MStatus | setSelfCollideWidth (float width)
| Sets the self collision width.
MStatus | getNumVertices (unsigned int &numVerts) const
| Returns the number of vertices in the underlying nParticle.
MStatus | getPositions (MFloatPointArray &positions) const
| gets the positions of the points of the underlying N Object.
MStatus | getVelocities (MFloatPointArray &velocities) const
| gets the velocities of the points of the underlying N cloth object.
MStatus | getThickness (MFloatArray &radius) const
| gets the radii of the points of the underlying N particle object.
MStatus | getInverseMass (MFloatArray &inverseMass) const
| gets the inverseMass of the points of the underlying N particle object.
MStatus | getBounce (MFloatArray &bounce) const
| gets the Bounce of the points of the underlying N particle object.
MStatus | getFriction (MFloatArray &friction) const
| gets the friction of the points of the underlying N particle object.
## Friends
class | MFnNObjectData Search for all occurrences

## Constructor & Destructor Documentation

MnParticle | ( |  | ) |

Default constructor.

The instance is set to contain nothing.

## Member Function Documentation

MStatus createNParticle | ( |  | ) |

Search for all occurrences

Creates the underlying Maya TnParticle and sets this class to wrap it.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setTopology | ( | const int | numPoints | ) |

Search for all occurrences

Sets the topology of the underlying N Object.

This must be called whenever the number of particles changes, before setting any particle properties

Parameters:

  [in] | numPoints | number of particles

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setPositions | ( | const MFloatPointArray & | positions,
|  | bool | startFrame = `true`
| ) |  |

Search for all occurrences

Sets the positions of the vertices of the underlying N cloth object.

Parameters:

  [in] | positions | the array containing the position information
  [in] | startFrame | whether this information represents the state of the object at the start frame.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setVelocities | ( | const MFloatPointArray & | velocities | ) |

Search for all occurrences

Sets the velocities of the vertices of the underlying Ncloth object.

Parameters:

  [in] | velocities | the array containing the velocity information

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setThickness | ( | float | radius | ) |

Search for all occurrences

sets a radius on each point collision purposes.

The bigger the radius/thickness, the more easily things collide.

Parameters:

  [in] | radius | the radius to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setThickness | ( | float * | radius | ) |

Search for all occurrences

sets a radius (thickness) on a per point basis for collision purposes.

The bigger the radius, the more easily things collide.

Parameters:

  [in] | radius | the radius to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setInverseMass | ( | float | invMass | ) |

Search for all occurrences

sets the mass for every point in this mesh

Parameters:

  [in] | invMass | the inverse of the mass. A value of 0 means an infinitely heavy object.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setInverseMass | ( | float * | invMass | ) |

Search for all occurrences

sets the mass on a per point basis

Parameters:

  [in] | invMass | the inverse of the mass. A value of 0 means an infinitely heave object.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setBounce | ( | float | bounce | ) |

Search for all occurrences

sets the bounce for every point in this mesh

Parameters:

  [in] | bounce | value of bounce to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setBounce | ( | float * | bounce | ) |

Search for all occurrences

sets the bounce on a per point basis in this mesh

Parameters:

  [in] | bounce | value of bounce to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setFriction | ( | float | friction | ) |

Search for all occurrences

sets the friction for every point in this mesh

Parameters:

  [in] | friction | the friction to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setFriction | ( | float * | friction | ) |

Search for all occurrences

sets the friction on a per point basis for this mesh

Parameters:

  [in] | friction | the friction to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setDamping | ( | float | damping | ) |

Search for all occurrences

sets the damping for every point in this mesh

Parameters:

  [in] | damping | the damping value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setDamping | ( | float * | damping | ) |

Search for all occurrences

sets the damping on a per point basis in this mesh

Parameters:

  [in] | damping | the damping value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setDisableGravity | ( | const bool | b | ) |

Search for all occurrences

Sets whether gravity will affect this object.

Parameters:

  [in] | b | whether to calculate gravity

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setLiquidSimulation | ( | const bool | b | ) |

Search for all occurrences

Sets whether this object will solve as a liquid.

Parameters:

  [in] | b | whether to calculate liquid

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setIncompressibility | ( | float | incompressibility | ) |

Search for all occurrences

sets the incompressibility

Parameters:

  [in] | incompressibility | the incompressibility value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setRestDensity | ( | float | restDensity | ) |

Search for all occurrences

sets the rest density for every point in this mesh

Parameters:

  [in] | restDensity | the rest density value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setLiquidRadiusScale | ( | float | liquidRadiusScale | ) |

Search for all occurrences

sets the liquidRadiusScale for every point in this mesh

Parameters:

  [in] | liquidRadiusScale | the liquidRadiusScale value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setViscosity | ( | float | viscosity | ) |

Search for all occurrences

sets the viscosity for every point in this mesh

Parameters:

  [in] | viscosity | the viscosity value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setViscosity | ( | float * | viscosity | ) |

Search for all occurrences

sets the viscosity on a per point basis in this mesh

Parameters:

  [in] | viscosity | the viscosity value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setSurfaceTension | ( | float | surfaceTension | ) |

Search for all occurrences

sets the surfaceTension for every point in this mesh

Parameters:

  [in] | surfaceTension | the surfaceTension value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setSurfaceTension | ( | float * | surfaceTension | ) |

Search for all occurrences

sets the surfaceTension on a per point basis in this mesh

Parameters:

  [in] | surfaceTension | the surfaceTension value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setMaxIterations | ( | const int | it | ) |

Search for all occurrences

Sets the number of iterations the solver will perform on various dynamic properties like drag, damping, stretch and bend.

Higher iterations take longer, and the primary use of this attribute is to keep things from locking up should high iteration values be requested.

Parameters:

  [in] | it | number of iterations

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setMaxSelfCollisionIterations | ( | const int | it | ) |

Search for all occurrences

Sets the number of iterations the solver will perform for self collisions on this object.

Parameters:

  [in] | it | number of iterations

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setSelfCollisionSoftness | ( | float | softness | ) |

Search for all occurrences

This allows one to lower the repulsive force of self collisions such that some interpenetration within the collide width is allowed.

This can in some cases reduce jitter due to self collision with low selfCollideIterations. In general its use should be avoided, however.

Parameters:

  [in] | softness | value to set.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setDragAndLift | ( | float | drag,
|  | float | lift
| ) |  |

Search for all occurrences

Sets the drag and lift values for the cloth.

Parameters:

  [in] | drag | value of drag
  [in] | lift | value of lift

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setCollide | ( | const bool | b | ) |

Search for all occurrences

Sets whether collisions will affect this object.

Parameters:

  [in] | b | whether to calculate collision

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setSelfCollide | ( | const bool | b | ) |

Search for all occurrences

Sets whether self collisions will affect this object.

Parameters:

  [in] | b | whether to calculate self collision

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus setSelfCollideWidth | ( | float | width | ) |

Search for all occurrences

Sets the self collision width.

Parameters:

  [in] | width | value to set

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getNumVertices | ( | unsigned int & | numVerts | ) | const

Search for all occurrences

Returns the number of vertices in the underlying nParticle.

Parameters:

  [out] | numVerts | Number of vertices.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getPositions | ( | MFloatPointArray & | positions | ) | const

Search for all occurrences

gets the positions of the points of the underlying N Object.

Parameters:

  [out] | positions | the array will be filled with the positions.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getVelocities | ( | MFloatPointArray & | velocities | ) | const

Search for all occurrences

gets the velocities of the points of the underlying N cloth object.

Parameters:

  [out] | velocities | the array will be filled with the positions.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getThickness | ( | MFloatArray & | radius | ) | const

Search for all occurrences

gets the radii of the points of the underlying N particle object.

Parameters:

  [out] | radius | the array will be filled with the radii.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getInverseMass | ( | MFloatArray & | inverseMass | ) | const

Search for all occurrences

gets the inverseMass of the points of the underlying N particle object.

Parameters:

  [out] | inverseMass | the array will be filled with the inverse masses.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getBounce | ( | MFloatArray & | bounce | ) | const

Search for all occurrences

gets the Bounce of the points of the underlying N particle object.

Parameters:

  [out] | bounce | the array will be filled with the bounce.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MStatus getFriction | ( | MFloatArray & | friction | ) | const

Search for all occurrences

gets the friction of the points of the underlying N particle object.

Parameters:

  [out] | friction | the array will be filled with the friction.

Returns:
  - MS::kSuccess the operation was completed successfully
  - MS::kFailure the operation failed

MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle
MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle MnParticle