C++ API Reference
MnParticle Class Reference

Class for wrapping N cloth objects. More...

#include <MnParticle.h>

+ Inheritance diagram for MnParticle:

Public Member Functions

 MnParticle ()
 Default constructor. More...
 
 ~MnParticle () override
 The class destructor.
 
MStatus createNParticle ()
 Creates the underlying Maya TnParticle and sets this class to wrap it. More...
 
MStatus setTopology (const int numPoints)
 Sets the topology of the underlying N Object. More...
 
MStatus setPositions (const MFloatPointArray &positions, bool startFrame=true)
 Sets the positions of the vertices of the underlying nParticle object. More...
 
MStatus setVelocities (const MFloatPointArray &velocities)
 Sets the velocities of the vertices of the underlying nParticle object. More...
 
MStatus setThickness (float radius)
 sets a radius on each point collision purposes. More...
 
MStatus setThickness (float *radius)
 sets a radius (thickness) on a per point basis for collision purposes. More...
 
MStatus setInverseMass (float invMass)
 sets the mass for every particle More...
 
MStatus setInverseMass (float *invMass)
 sets the mass on a per point basis More...
 
MStatus setBounce (float bounce)
 sets the bounce for every particle More...
 
MStatus setBounce (float *bounce)
 sets the bounce on a per point basis for these particles More...
 
MStatus setFriction (float friction)
 sets the friction for every particle More...
 
MStatus setFriction (float *friction)
 sets the friction on a per point basis for these particles More...
 
MStatus setDamping (float damping)
 sets the damping for every particle More...
 
MStatus setDamping (float *damping)
 sets the damping on a per point basis for these particles More...
 
MStatus setDisableGravity (const bool b)
 Sets whether gravity will affect this object. More...
 
MStatus setLiquidSimulation (const bool b)
 Sets whether this object will solve as a liquid. More...
 
MStatus setIncompressibility (float incompressibility)
 sets the incompressibility More...
 
MStatus setRestDensity (float restDensity)
 sets the rest density for every particle More...
 
MStatus setLiquidRadiusScale (float liquidRadiusScale)
 sets the liquidRadiusScale for every particle More...
 
MStatus setViscosity (float viscosity)
 sets the viscosity for every particle More...
 
MStatus setViscosity (float *viscosity)
 sets the viscosity on a per point basis for these particles More...
 
MStatus setSurfaceTension (float surfaceTension)
 sets the surfaceTension for every particle More...
 
MStatus setSurfaceTension (float *surfaceTension)
 sets the surfaceTension on a per point basis for these particles More...
 
MStatus setMaxIterations (const int it)
 Sets the number of iterations the solver will perform on various dynamic properties like drag, damping, stretch and bend. More...
 
MStatus setMaxSelfCollisionIterations (const int it)
 Sets the number of iterations the solver will perform for self collisions on this object. More...
 
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. More...
 
MStatus setDragAndLift (float drag, float lift)
 Sets the drag and lift values for the nParticle. More...
 
MStatus setCollide (const bool b)
 Sets whether collisions will affect this object. More...
 
MStatus setSelfCollide (const bool b)
 Sets whether self collisions will affect this object. More...
 
MStatus setSelfCollideWidth (float width)
 Sets the self collision width. More...
 
MStatus getNumVertices (unsigned int &numVerts) const
 Returns the number of vertices in the underlying nParticle. More...
 
MStatus getPositions (MFloatPointArray &positions) const
 gets the positions of the points of the underlying N Object. More...
 
MStatus getVelocities (MFloatPointArray &velocities) const
 gets the velocities of the points of the underlying nParticle object. More...
 
MStatus getThickness (MFloatArray &radius) const
 gets the radii of the points of the underlying N particle object. More...
 
MStatus getInverseMass (MFloatArray &inverseMass) const
 gets the inverseMass of the points of the underlying N particle object. More...
 
MStatus getBounce (MFloatArray &bounce) const
 gets the Bounce of the points of the underlying N particle object. More...
 
MStatus getFriction (MFloatArray &friction) const
 gets the friction of the points of the underlying N particle object. More...
 
- Public Member Functions inherited from MnObject
 MnObject ()
 Default constructor. More...
 
virtual ~MnObject ()
 The class destructor.
 

Protected Member Functions

void setNParticle (TnParticle *nObj, bool own)
 Sets the TnParticle pointer which this class wraps. More...
 
- Protected Member Functions inherited from MnObject
void setNObject (TnObject *nObj, bool own)
 Sets the TnObject pointer which this class wraps. More...
 

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.

Constructor & Destructor Documentation

Default constructor.

The instance is set to contain nothing.

Member Function Documentation

MStatus createNParticle ( )

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)

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]numPointsnumber of particles
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setPositions ( const MFloatPointArray positions,
bool  startFrame = true 
)

Sets the positions of the vertices of the underlying nParticle object.

Parameters
[in]positionsthe array containing the position information
[in]startFramewhether 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)

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

Parameters
[in]velocitiesthe array containing the velocity information
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setThickness ( float  radius)

sets a radius on each point collision purposes.

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

Parameters
[in]radiusthe radius to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setThickness ( float *  radius)

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

The bigger the radius, the more easily things collide.

Parameters
[in]radiusthe radius to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setInverseMass ( float  invMass)

sets the mass for every particle

Parameters
[in]invMassthe 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)

sets the mass on a per point basis

Parameters
[in]invMassthe 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)

sets the bounce for every particle

Parameters
[in]bouncevalue of bounce to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setBounce ( float *  bounce)

sets the bounce on a per point basis for these particles

Parameters
[in]bouncevalue of bounce to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setFriction ( float  friction)

sets the friction for every particle

Parameters
[in]frictionthe friction to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setFriction ( float *  friction)

sets the friction on a per point basis for these particles

Parameters
[in]frictionthe friction to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setDamping ( float  damping)

sets the damping for every particle

Parameters
[in]dampingthe damping value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setDamping ( float *  damping)

sets the damping on a per point basis for these particles

Parameters
[in]dampingthe damping value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setDisableGravity ( const bool  b)

Sets whether gravity will affect this object.

Parameters
[in]bwhether to calculate gravity
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setLiquidSimulation ( const bool  b)

Sets whether this object will solve as a liquid.

Parameters
[in]bwhether to calculate liquid
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setIncompressibility ( float  incompressibility)

sets the incompressibility

Parameters
[in]incompressibilitythe incompressibility value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setRestDensity ( float  restDensity)

sets the rest density for every particle

Parameters
[in]restDensitythe rest density value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setLiquidRadiusScale ( float  liquidRadiusScale)

sets the liquidRadiusScale for every particle

Parameters
[in]liquidRadiusScalethe liquidRadiusScale value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setViscosity ( float  viscosity)

sets the viscosity for every particle

Parameters
[in]viscositythe viscosity value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setViscosity ( float *  viscosity)

sets the viscosity on a per point basis for these particles

Parameters
[in]viscositythe viscosity value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setSurfaceTension ( float  surfaceTension)

sets the surfaceTension for every particle

Parameters
[in]surfaceTensionthe surfaceTension value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setSurfaceTension ( float *  surfaceTension)

sets the surfaceTension on a per point basis for these particles

Parameters
[in]surfaceTensionthe surfaceTension value to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setMaxIterations ( const int  it)

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]itnumber of iterations
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setMaxSelfCollisionIterations ( const int  it)

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

Parameters
[in]itnumber of iterations
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
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.

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

Parameters
[in]softnessvalue to set.
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setDragAndLift ( float  drag,
float  lift 
)

Sets the drag and lift values for the nParticle.

Parameters
[in]dragvalue of drag
[in]liftvalue of lift
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setCollide ( const bool  b)

Sets whether collisions will affect this object.

Parameters
[in]bwhether to calculate collision
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setSelfCollide ( const bool  b)

Sets whether self collisions will affect this object.

Parameters
[in]bwhether to calculate self collision
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus setSelfCollideWidth ( float  width)

Sets the self collision width.

Parameters
[in]widthvalue to set
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus getNumVertices ( unsigned int &  numVerts) const

Returns the number of vertices in the underlying nParticle.

Parameters
[out]numVertsNumber of vertices.
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
MStatus getPositions ( MFloatPointArray positions) const

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

Parameters
[out]positionsthe 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

gets the velocities of the points of the underlying nParticle object.

Parameters
[out]velocitiesthe 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

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

Parameters
[out]radiusthe 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

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

Parameters
[out]inverseMassthe 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

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

Parameters
[out]bouncethe 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

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

Parameters
[out]frictionthe array will be filled with the friction.
Returns
  • MS::kSuccess the operation was completed successfully
  • MS::kFailure the operation failed
void setNParticle ( TnParticle *  nObj,
bool  own 
)
protected

Sets the TnParticle pointer which this class wraps.

If own is true, then the TnParticle will be deleted when this instance is destroyed.

Parameters
[in]nObjTnParticle object.
[in]ownShould this instance take ownership of the TnParticle?

The documentation for this class was generated from the following files: