#include <MnCloth.h>
This class wraps the internal Maya representation of N cloth objects suitable for use with the Nucleus solver.
Public Member Functions | |
MnCloth () | |
virtual | ~MnCloth () |
MStatus | createNCloth () |
MStatus | setTopology (const int numFaces, int *numVertsPerFace, int *faces, const int numEdges, int *edges) |
MStatus | setPositions (const MFloatPointArray &positions, bool startFrame=true) |
MStatus | setVelocities (const MFloatPointArray &velocities) |
MStatus | setBendRestAngleFromPositions (const MFloatPointArray &positions) |
MStatus | setLinksRestLengthFromPositions (const MFloatPointArray &positions) |
MStatus | setInputMeshAttractPositions (const MFloatPointArray &positions) |
MStatus | setInputMeshAttractDamping (float damping) |
MStatus | setInputMeshAttractAndRigidStrength (float *inputAttractArray, float *rigidArray, float *deformArray) |
MStatus | setComputeRestLength (const bool b) |
MStatus | setComputeRestAngles (const bool b) |
MStatus | setThickness (float radius) |
MStatus | setThickness (float *radius) |
MStatus | setInverseMass (float invMass) |
MStatus | setInverseMass (float *invMass) |
MStatus | setBounce (float bounce) |
MStatus | setBounce (float *bounce) |
MStatus | setFriction (float friction) |
MStatus | setFriction (float *friction) |
MStatus | setDamping (float damping) |
MStatus | setDamping (float *damping) |
MStatus | setSelfCollisionFlags (const bool vertToVert, const bool vertToEdge=false, const bool vertToFace=false, const bool edgeToEdge=false, const bool edgeToFace=false) |
MStatus | setCollisionFlags (const bool vertToVert, const bool edgeToEdge=false, const bool faceToFace=false) |
MStatus | setDisableGravity (const bool b) |
MStatus | setMaxIterations (const int it) |
MStatus | setMaxSelfCollisionIterations (const int it) |
MStatus | setSelfCollisionSoftness (float softness) |
MStatus | setSelfTrappedCheck (bool on) |
MStatus | setSelfCrossoverPush (float val) |
MStatus | setDragAndLift (float drag, float lift) |
MStatus | setTangentialDrag (float tangentialDrag) |
MStatus | setStartPressure (float startPressure) |
MStatus | setSealHoles (bool seal) |
MStatus | setPressure (float pressure) |
MStatus | setTrackVolume (bool track) |
MStatus | setIncompressibility (float v) |
MStatus | setPressureDamping (float damp) |
MStatus | setPumpRate (float pump) |
MStatus | setAirTightness (float airTightness) |
MStatus | setAddCrossLinks (float addCrossLinks) |
MStatus | setBendAngleDropoff (float dropoff) |
MStatus | setShearResistance (float resistance) |
MStatus | setStretchAndCompressionResistance (float stretchResist, float compressionResist) |
MStatus | setStretchAndCompressionResistance (float *stretchResist, float *compressionResist) |
MStatus | setBendAngleScale (float scale) |
MStatus | setRestitutionAngle (float angle) |
MStatus | setRestitutionTension (float tension) |
MStatus | setSelfCollideWidth (float width) |
MStatus | setBendResistance (float strength) |
MStatus | getNumVertices (unsigned int &numVerts) const |
MStatus | getPositions (MFloatPointArray &positions) const |
MStatus | getVelocities (MFloatPointArray &velocities) const |
Friends | |
class | MFnNObjectData |
MnCloth::MnCloth | ( | ) |
Default constructor. The instance is set to contain nothing.
MnCloth::~MnCloth | ( | ) | [virtual] |
The class destructor.
MStatus MnCloth::createNCloth | ( | ) |
Creates the underlying Maya TnCloth and sets this class to wrap it.
MStatus MnCloth::setTopology | ( | const int | numFaces, | |
int * | numVertsPerFace, | |||
int * | faces, | |||
const int | numEdges, | |||
int * | edges | |||
) |
sets the topology of the underlying N Object. Before calling other methods, this must be the first method you call once the cloth object is created.
[in] | numFaces | number of faces |
[in] | numVertsPerFace | an array of size numFaces, where each element describes the number of verts on that face |
[in] | faces | an array containing the actual face description. Each element is a vertex index. |
[in] | numFaces | number of edges |
[in] | edges | an array containing the edge description. Each element is a vertex index. |
MStatus MnCloth::setPositions | ( | const MFloatPointArray & | positions, | |
bool | startFrame = true | |||
) |
Sets the positions of the vertices of the underlying N cloth object
[in] | positions | the array containing the position information |
[in] | startFrame | whether this information represents the state of the object at the start frame. |
MStatus MnCloth::setVelocities | ( | const MFloatPointArray & | velocities | ) |
Sets the velocities of the vertices of the underlying Ncloth object
[in] | velocities | the array containing the velocity information |
MStatus MnCloth::setBendRestAngleFromPositions | ( | const MFloatPointArray & | positions | ) |
Sets the the bend rest angle from the list of positions for the underlying N Object This sets the shape that bend resistance is trying to achieve.
[in] | positions | the array containing the position information |
MStatus MnCloth::setLinksRestLengthFromPositions | ( | const MFloatPointArray & | positions | ) |
Sets the the rest length from the list of positions for the underlying N Object. This sets the shape that the stretch/compression resistance are trying to achieve.
[in] | positions | the array containing the position information |
MStatus MnCloth::setInputMeshAttractPositions | ( | const MFloatPointArray & | positions | ) |
Sets the positions for input mesh attract
[in] | positions | the array containing the position information |
MStatus MnCloth::setInputMeshAttractDamping | ( | float | damping | ) |
Defines how springy the effect of Input Mesh Attract is. At a value of zero input mesh attract will behave like a spring connection from the input mesh to the output dynamic mesh. The cloth will tend to wiggle about the input mesh position. As the Input Attract Damp is increased to 1 the cloth mesh will still move to the input mesh position but not have the momentum to travel past it, so will no longer occillate about the input position.
[in] | damping | the damping value |
MStatus MnCloth::setInputMeshAttractAndRigidStrength | ( | float * | inputAttractArray, | |
float * | rigidArray, | |||
float * | deformArray | |||
) |
Sets on a per particle basis, the amount by which each particle is affected by the input mesh attract, rigidity, and deformability. High values for the input mesh attract will make points stick closely to the input mesh. High values for the rigidArray will make the object behave like a rigid body.
These arguments actually encode 2 pieces of information in 1. It contains instructions for:
A) The number of iterations and B) The strength of the effect
The number of iterations is the maximum value over the array passed in. The relative strength, measured from 0 to 1, is the normalized value of each element of the array.
For example, if for the inputAttractArray one were to specify a value of 10.0 for the first element, and 1.0 for the rest, it means that the solver should take 10 steps to compute inputMeshAttract, and the first particle has a strength of 1 while the rest have a strength of 0.1.
[in] | inputAttractArray | values for the input mesh attract |
[in] | rigidArray | values for rigidity |
[in] | deformArray | values for deformability |
MStatus MnCloth::setComputeRestLength | ( | const bool | b | ) |
Sets whether rest lengths will be automatically computed, or overridden manually. If this is set to false, then you must call setLinksRestLengthFromPositions() to set the rest lengths.
[in] | b | whether to compute rest lengths |
MStatus MnCloth::setComputeRestAngles | ( | const bool | b | ) |
Sets whether rest angles will be automatically computed, or overridden manually. If this is set to false, then you must call setBendRestAngleFromPositions() to set the rest lengths.
[in] | b | whether to compute rest angles |
MStatus MnCloth::setThickness | ( | float | radius | ) |
sets a radius on each point of the mesh for collision purposes. The bigger the radius/thickness, the more easily things collide.
[in] | radius | the radius to set |
MStatus MnCloth::setThickness | ( | float * | radius | ) |
sets a radius (thickness) on a per point basis for the mesh for collision purposes. The bigger the radius, the more easily things collide.
[in] | radius | the radius to set |
MStatus MnCloth::setInverseMass | ( | float | invMass | ) |
sets the mass for every point in this mesh
[in] | invMass | the inverse of the mass. A value of 0 means an infinitely heave object. |
MStatus MnCloth::setInverseMass | ( | float * | invMass | ) |
sets the mass on a per point basis in this mesh
[in] | invMass | the inverse of the mass. A value of 0 means an infinitely heave object. |
MStatus MnCloth::setBounce | ( | float | bounce | ) |
sets the bounce for every point in this mesh
[in] | bounce | value of bounce to set |
MStatus MnCloth::setBounce | ( | float * | bounce | ) |
sets the bounce on a per point basis in this mesh
[in] | bounce | value of bounce to set |
MStatus MnCloth::setFriction | ( | float | friction | ) |
sets the friction for every point in this mesh
[in] | friction | the friction to set |
MStatus MnCloth::setFriction | ( | float * | friction | ) |
sets the friction on a per point basis for this mesh
[in] | friction | the friction to set |
MStatus MnCloth::setDamping | ( | float | damping | ) |
sets the damping for every point in this mesh
[in] | damping | the damping value to set |
MStatus MnCloth::setDamping | ( | float * | damping | ) |
sets the on a per point basis in this mesh
[in] | damping | the damping value to set |
MStatus MnCloth::setSelfCollisionFlags | ( | const bool | vertToVert, | |
const bool | vertToEdge = false , |
|||
const bool | vertToFace = false , |
|||
const bool | edgeToEdge = false , |
|||
const bool | edgeToFace = false | |||
) |
Sets how (or if) this object will collide with itself.
[in] | vertToVert | whether to calculate vertex - vertex collisions |
[in] | vertToEdge | whether to calculate vertex - edge collisions |
[in] | vertToFace | whether to calculate vertex - face collisions |
[in] | edgeToEdge | whether to calculate edge - edge collisions |
[in] | edgeToFace | whether to calculate edge - face collisions |
MStatus MnCloth::setCollisionFlags | ( | const bool | vertToVert, | |
const bool | edgeToEdge = false , |
|||
const bool | faceToFace = false | |||
) |
Sets how (or if) this object will collide with other objects.
[in] | vertToVert | whether to calculate vertex - vertex collisions |
[in] | edgeToEdge | whether to calculate edge - edge collisions |
[in] | faceToFace | whether to calculate face - face collisions |
MStatus MnCloth::setDisableGravity | ( | const bool | b | ) |
Sets whether gravity will affect this object
[in] | b | whether to calculate gravity |
MStatus MnCloth::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.
[in] | it | number of iterations |
MStatus MnCloth::setMaxSelfCollisionIterations | ( | const int | it | ) |
Sets the number of iterations the solver will perform for self collisions on this object.
[in] | it | number of iterations |
MStatus MnCloth::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.
[in] | softness | value to set. |
MStatus MnCloth::setSelfTrappedCheck | ( | bool | on | ) |
This tracks self collision crossovers and attempts to push the crossed over points back. It assumes that the surface is in a good state at the start and attempts to preserve that relative state. It is useful in cases where cloth can get caught between passive objects than interpenetrate (for example an elbow passing through a chest). Rather than get stuck on the wrong side this allows the cloth to push back to the correct side when the passive objects later separate.
[in] | on | whether to turn on self trapped check. |
MStatus MnCloth::setSelfCrossoverPush | ( | float | val | ) |
See node documentation.
[in] | val | value for crossover push |
MStatus MnCloth::setDragAndLift | ( | float | drag, | |
float | lift | |||
) |
Sets the drag and lift values for the cloth
[in] | drag | value of drag |
[in] | lift | value of lift |
MStatus MnCloth::setTangentialDrag | ( | float | tangentialDrag | ) |
Sets the tangential drag values for the cloth. Defines the component of drag tangent to the surface. With a value of zero a flat plane will slice through air with no resistance and only have drag when moving along its normal axis. With a value of 1.0 the effect of drag will be equal in all directions.
[in] | tangentialDrag | the tangential drag |
MStatus MnCloth::setStartPressure | ( | float | startPressure | ) |
With the volume tracking pressure method this defines the relative air pressure inside the object at the startframe.
[in] | startPressure | the start pressure |
MStatus MnCloth::setSealHoles | ( | bool | seal | ) |
When the volume tracking pressure method is used this determines if physical holes in the cloth model are treated as being capped or not. If holes are not sealed, then air can escape out them, which also has the effect of pushing the cloth. For example, this can simulate a rubber balloon that is suddenly released. It also allows for inflow based on motion of the cloth. The opening in a parachute will allow air to flow in as it falls down, causing sideways pressure that inflates it. Note that drag alone cannot achieve this sort of effect
[in] | seal | whether to seal holes |
MStatus MnCloth::setPressure | ( | float | pressure | ) |
Sets the pressure within the cloth. This defines a force applied along the surface normal direction
[in] | pressure | the value of pressure to set |
MStatus MnCloth::setTrackVolume | ( | bool | track | ) |
[in] | track | whether to track volume |
MStatus MnCloth::setIncompressibility | ( | float | v | ) |
When the volume tracking pressure model is used this defines how incompressible the internal volume of fluid is. This also will affect how much force is applied to the cloth when air is pumped in. In the case of a balloon higher values of incompressibility will overcome higher stretch resistance. Note that higher incompressibility may require more calculation time.
[in] | v | how incompressible the cloth is |
MStatus MnCloth::setPressureDamping | ( | float | damp | ) |
Sets the damping value for pressure
[in] | damp | value to set |
MStatus MnCloth::setPumpRate | ( | float | pump | ) |
Defines the rate at which air pressure is added to the object
[in] | pump | value to set |
MStatus MnCloth::setAirTightness | ( | float | airTightness | ) |
Defines the rate at which air can escape from the object, or how permiable the surface is. This is in addition to any physical holes in the model, which can be be capped or not using the seal holes method.
[in] | airTightness | value to set |
MStatus MnCloth::setAddCrossLinks | ( | float | addCrossLinks | ) |
For faces with more than 3 vertices this will create additional stretch and bends links such that each vertex is connected to each other vertex. If this is off then the links will exactly match the meshes list of edges. For a quad meshes having addCrossLinks off would allow the cloth to shear, unless shear resistance was used.
[in] | addCrossLinks | value to set |
MStatus MnCloth::setBendAngleDropoff | ( | float | dropoff | ) |
Defines the way bend resistance changes with the angle. At higher values the bend will resist more at high angles then when the surface is nearly flat.
[in] | dropoff | value to set |
MStatus MnCloth::setShearResistance | ( | float | resistance | ) |
Sets the shear resistance. Shear can be thought of as the bend in the plane of the cloth.
[in] | resistance | value to set |
MStatus MnCloth::setStretchAndCompressionResistance | ( | float | stretchResist, | |
float | compressionResist | |||
) |
Stretch Resistance:
Defines the amount that the material will resist stretching when under tension. Large values generally require more computation, so they may result in longer simulation times. Note that the scalingRelation attribute affects how this value is defined. Also one may need to additionally make the both collision iterations on the solver and constraint strength values high to keep stretching low.
Compression Resistance:
Defines the amount that the material will resist compression. Note that sometimes it is useful to have this value be lower than the Stretch Resistance, because the mesh resolution is only an approximation to a true surface, which could possibly fold within the length of a triangle. If one has a rest position for a cloth that is not flat and the compression and stretch resistance are both high then this can make cloth appear too stiff because the topology locks up. This problem is most noticable when the faces have relatively high angles relative to each other. Having a low compression resistance allows the material keep from locking up, yet still not appear to stretchy. Large values generally require more computation, so they may result in longer simulation times.
[in] | stretchResist | value to set for stretch |
[in] | compressionResist | value to set for compression |
MStatus MnCloth::setStretchAndCompressionResistance | ( | float * | stretchResist, | |
float * | compressionResist | |||
) |
Sets the stretch and compression resistance for the mesh on a per vertex basis
[in] | stretchResist | value to set for stretch |
[in] | compressionResist | value to set for compression |
MStatus MnCloth::setBendAngleScale | ( | float | scale | ) |
Defines the amount by which the rest state of the bend angle is scaled.
[in] | scale | value to set |
MStatus MnCloth::setRestitutionAngle | ( | float | angle | ) |
Defines how far we can bend across an edge before it will fail to go back to the rest angle when there are no forces acting on the cloth.
[in] | angle | value to set |
MStatus MnCloth::setRestitutionTension | ( | float | tension | ) |
How far can the links be stretched before they fail to go back to their rest length when there are no forces acting on the cloth. When the tension is greater than the defined value the defined rest length will increase until the tension is equal this value. For very low values the material will pull apart like taffy, yet still resist stretching under mild forces.
[in] | tension | value to set |
MStatus MnCloth::setSelfCollideWidth | ( | float | width | ) |
Sets the self collision width
[in] | width | value to set |
MStatus MnCloth::setBendResistance | ( | float | strength | ) |
Bend resistance measures the amount of attraction to the restAngle, which is defined between cvs on either side of an edge. Larger values will tend to make the surface more rigid and will take longer to compute.
[in] | strength | value to set |
MStatus MnCloth::getNumVertices | ( | unsigned int & | numVerts | ) | const |
Returns the number of vertices in the underlying n Cloth
[out] | numVerts | Number of vertices. |
MStatus MnCloth::getPositions | ( | MFloatPointArray & | positions | ) | const |
gets the positions of the points of the underlying N Object.
[out] | positions | the array will be filled with the positions. |
MStatus MnCloth::getVelocities | ( | MFloatPointArray & | velocities | ) | const |
gets the velocities of the points of the underlying N cloth object.
[in] | velocities | the array will be filled with the positions. |
Autodesk® Maya® 2010 © 1997-2009 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |