cloth |
Cloth model entity; should be a mesh with a large number of vertices. |
attach1, attach2 | Entities to attach the cloth to (such as a flag pole), or NULL for no attached entity. |
flag1, flag2 | Attachment flags. If at 0, it's a one-way attachment, i.e. the cloth can be moved by the entity, but does affect the entity. The following flags can be combined: |
NX_CLOTH_ATTACHMENT_TWOWAY | The cloth can apply force to the entity (only for dynamic shapes). |
NX_CLOTH_ATTACHMENT_TEARABLE | The entity can snap apart when enough force is exerted on the cloth. |
cloth_options | Array of 40 cloth parameters, or CLOTH_DEFAULT for an array of default parameters. The following parameters are available: |
cloth_options[0] (default 0.2) | thickness: Thickness is usually a fraction of the overall extent of the cloth and should not be set to a value greater than that. A good value is the maximal distance between two adjacent cloth particles in their rest pose. Visual artifacts or collision problems may appear if the thickness is too small. |
cloth_options[1] (default 0.2) | selfCollisionThickness: Size of the particle diameters used for self collision and inter-collision. The self collision thickness is usually a fraction of the overall extent of the cloth and should not be set to a value greater than that. A good value is the maximal distance between two adjacent cloth particles in their rest pose. Visual artifacts or collision problems may appear if the particle radius is too small. |
cloth_options[2] (default 1.0) | density: Density of the cloth (mass per area). |
cloth_options[3] (default 1.0) | bendingStiffness: Bending stiffness of the cloth. Only has an effect if the flag NX_CLF_BENDING is set. |
cloth_options[4] (default 1.0) | stretchingStiffness: Stretching stiffness of the cloth. Stretching stiffness must be larger than 0. |
cloth_options[5] (default 1.0) | hardStretchLimitationFactor: Defines the hard stretch elongation limit. If the flag NX_CLF_HARD_STRETCH_LIMITATION is set, the solver pulls vertices with a maxDistance greater zero towards vertices with maxDistance zero (attached). This reduces the stretchiness even for low solver iteration counts. The process is non-physical and can yield small ghost forces. The hardStretchLimitationFactor defines by what factor the cloth is allowed to stretch. |
cloth_options[6] (0..1, default 0.5) | dampingCoefficient: Spring damping of the cloth. Only has an effect if the flag NX_CLF_DAMPING is set. |
cloth_options[7] (0..1, default 0.5) | friction: Friction coefficient. Defines the damping of the velocities of cloth particles that are in contact. |
cloth_options[8] (default 1.0) | pressure: If the flag NX_CLF_PRESSURE is set, this variable defines the volume of air inside the mesh as volume(default pressure * restVolume. |
cloth_options[9] (>=1, default 1.5) | tearFactor: If the flag NX_CLF_TEARABLE is set, this variable defines the elongation factor that causes the cloth to tear. When the buffer cannot hold the new vertices anymore, tearing stops. |
cloth_options[10] (default 0.2) | collisionResponseCoefficient: Defines a factor for the impulse transfer from cloth to colliding rigid bodies. Only has an effect if NX_CLF_COLLISION_TWOWAY is set. |
cloth_options[11] (0..1, default 0.2) | attachmentResponseCoefficient: Defines a factor for the impulse transfer from cloth to attached rigid bodies. Only has an effect if the mode of the attachment is set to NX_CLOTH_ATTACHMENT_TWOWAY. |
cloth_options[12] (>=1, default 1.5) | attachmentTearFactor: If the flag NX_CLOTH_ATTACHMENT_TEARABLE is set in the attachment method, this variable defines the elongation factor that causes the attachment to tear. |
cloth_options[13] (default 1.0) | toFluidResponseCoefficient: Defines a factor for the impulse transfer from this cloth to colliding fluids.Only has an effect if the NX_CLF_FLUID_COLLISION flag is set. Note: Large values can cause instabilities. |
cloth_options[14] (default 1.0) | fromFluidResponseCoefficient: Defines a factor for the impulse transfer from colliding fluids to this cloth.Only has an effect if the NX_CLF_FLUID_COLLISION flag is set. Note: Large values can cause instabilities. |
cloth_options[15] (0..1, default 1.0) | compressionLimit: Defines a factor up to which the cloth is weak under compression. This factor is the lower part of a range [limit, 1]. Whenever an edge is compressed to something between [limit, 1] * original length, the stretchingStiffness is multiplied with the compressionStiffness. Since the compressionStiffness is smaller or equal to 1, this will always define a range where the cloth reacts more softly to compressed edges. This feature is useful to generate small wrinkles features on the cloth mesh outside the SDK. |
cloth_options[16] (0..1, default 1.0) | compressionStiffness: Defines the stiffness of the cloth under compression. This stiffness scales the stretchingStiffness in the range defined by compressionLimit. |
cloth_options[17] (default 1.0) | minAdhereVelocity: If the NX_CLF_ADHERE flag is set the cloth moves partially in the frame of the attached actor.This feature is useful when the cloth is attached to a fast moving character.In that case the cloth adheres to the shape it is attached to while only velocities below the parameter minAdhereVelocity are used for secondary effects. |
cloth_options[18] (>=1, default 5) | solverIterations: Number of solver iterations.Note: Small numbers make the simulation faster while the cloth gets less stiff. Range: [1,infinity] |
cloth_options[19] (default 2) | hierarchicalSolverIterations: Number of iterations of the hierarchical cloth solver. For the this value to have an effect, the parameter NxClothMeshDesc.numHierarchyLevels must be greater then one when cooking the cloth mesh. In this case, the hierarchical cloth solver uses the mesh hierarchy to speed up convergence, i.e. makes large pieces of cloth less stretchy. |
cloth_options[20] (default 20.0*0.02) |
wakeUpCounter: The cloth wake up counter. Corresponds to 20 frames for the standard time step. |
cloth_options[21] (default -1.0) | sleepLinearVelocity: Maximum linear velocity at which cloth can go to sleep.If negative, the global default will be used. |
cloth_options[22] (0..31, default 0) | collisionGroup: Sets which collision group this cloth is part of. |
cloth_options[23] (default 0) | forceFieldMaterial: Force Field Material Index, index != 0 has to be created. |
cloth_options[24] (>= 0.01, default 0.25) | relativeGridSpacing: This parameter defines the size of grid cells for collision detection. Note: Setting the size of grid cells to small or to big can cause a crash at runtime. |
cloth_options[25..27] (default 0,0,0) | externalAcceleration: External acceleration which affects all non attached particles of the cloth. |
cloth_options[28..30] (default 0,0,0) | windAcceleration: Acceleration which acts normal to the cloth surface at each vertex. |
cloth_options[31..33] (default 0,0,0) |
validBounds, minimum and maximum coordinate. If the flag NX_CLF_VALIDBOUNDS is set, this variable defines the XYZ bounding box outside of which cloth particles are automatically removed from the simulation. |
cloth_options[37] | Cloth flags. The following flags can be combined: |
NX_CLF_GRAVITY | Applies gravity (default). |
NX_CLF_PRESSURE | Enables internal pressure for closed cloth meshes. See cloth_options[8]. |
NX_CLF_STATIC | Disables integration/simulation of the cloth. For example, a piece of cloth can be created in an authoring tool and simulated for awhile to achieve the desired effect, then made static to avoid the simulation overhead of continually simulating the cloth. This could be useful in making a table cloth seem real. Simulation for the cloth could be enabled again if the player comes into contact with the table. |
NX_CLF_DISABLE_COLLISION | Disables collision detection between the cloth and other objects. |
NX_CLF_VISUALIZATION | Enables visualizations, displays cloth points, attachment deviation from attachment points, etc. At present, visualization is only intended for internal use. Available visualizations may change. |
NX_CLF_BENDING | Enables bending constraints. Must be set to enable ortho bending (in addition to NX_CLF_BENDING_ORTHO). |
NX_CLF_BENDING_ORTHO | Applies a more robust/realistic bending constraint. When ortho bending is not enabled, the SDK applies bending constraints based on the distance between the two points either side of an edge. When ortho bending is enabled, the constraint is computed based on the actual angle between the two triangles either side of the edge. |
NX_CLF_DAMPING | Enables damping on individual cloth particles. |
NX_CLF_COMDAMPING | Only effective if NX_CLF_DAMPING is set. Excludes the center of mass of the cloth from damping, making the cloth damping local instead of global. |
NX_CLF_COLLISION_TWOWAY | Applies the cloth's force on rigid bodies (e.g., a cloth can move a rigid body). |
NX_CLF_TEARABLE | Enables cloth tearing. |
NX_CLF_HARDWARE | Directs the cloth to be simulated in hardware (flag has no effect after creation). |
NX_CLF_SELFCOLLISION | Enables self collision handling within a single piece of cloth. |
NX_CLF_VALIDBOUNDS | Enables valid bounds for this cloth. |
cloth_options[38..39] | Not used, for future extensions. |