Rapier C — 2D / f64 0.36.0+c.0
Loading...
Searching...
No Matches
Soft bodies

Particle recipes, materials, clusters, deformable meshes, and tearing. More...

Data Structures

struct  R2SoftBodyMaterial
 Plain configuration data; initialize defaults, edit, then apply. More...
struct  R2SoftRecoverySettings
 Plain configuration data; initialize defaults, edit, then apply. More...
struct  R2SoftFemParameters
 Plain configuration data; initialize defaults, edit, then apply. More...
struct  R2SoftBodiesSettings
 Plain configuration data; initialize defaults, edit, then apply. More...
struct  R2SoftEdgeSoftness
 Spring-coefficient override for one soft-body edge. More...
struct  R2SoftEdgeSoftnessView
 Borrowed elements; count counts elements. More...
struct  R2SoftEdgeTear
 Tear-resistance override for one soft-body edge. More...
struct  R2SoftEdgeTearView
 Borrowed elements; count counts elements. More...
struct  R2SoftBodyDescView
 Borrowed array of soft-body descriptions. More...
struct  R2SoftBodyDesc
 Copyable recipe, not an owned procedural builder. More...
struct  R2SoftBodyHandle
 Copyable non-owning handle: world pointer plus entity index and generation. More...
struct  R2SoftMeshBindingDesc
 Non-owning deformable binding description. More...
struct  R2SoftClusterSplit
 Cluster and proxy remapping after a soft-body split. More...
struct  R2SoftJointMove
 Impulse-joint movement between rigid proxies after tearing. More...
struct  R2SoftMeshId
 Stable identity of a live mesh within one soft body; matches Rapier's SoftMeshId. More...
struct  R2SoftMeshInfo
 Mesh identity and rendering metadata. More...

Macros

#define R2_SOFT_DESC_PARTICLES   0
 Soft-body selector: desc particles.
#define R2_SOFT_DESC_ROPE   1
 Soft-body selector: desc rope.
#define R2_SOFT_DESC_GRID   2
 Soft-body selector: desc grid.
#define R2_SOFT_DESC_CLOTH   3
 Soft-body selector: desc cloth.
#define R2_SOFT_DESC_CUBOID   4
 Soft-body selector: desc cuboid.
#define R2_SOFT_DESC_SURFACE   5
 Soft-body selector: desc surface.
#define R2_SOFT_DESC_DISK   6
 Soft-body selector: desc disk.
#define R2_SOFT_DESC_SPHERE   7
 Soft-body selector: desc sphere.
#define R2_SOFT_DESC_CLOTH_TUBE   8
 Soft-body selector: desc cloth tube.
#define R2_SOFT_DESC_VOLUMETRIC   9
 Soft-body selector: desc volumetric.
#define R2_SOFT_DESC_POLYGON   10
 Soft-body selector: closed counter-clockwise polygon of particles preserving its area (2D).
#define R2_SOFT_DESC_TRIMESH   11
 Soft-body selector: triangle mesh without cells, held by shape matching (2D).
#define R2_SOFT_BINDING_SKINNED   0
 Soft-body selector: binding skinned.
#define R2_SOFT_BINDING_DIRECT   1
 Soft-body selector: binding direct.
#define R2_SOFT_BINDING_DIRECT_BY_POSITION   2
 Soft-body selector: binding direct by position.
#define R2_SOFT_CELL_VOLUME   0
 Cell model that constrains volume without elastic shear response.
#define R2_SOFT_CELL_COROTATIONAL   1
 Corotational elastic cell model.
#define R2_SOFT_CELL_NEO_HOOKEAN   2
 Neo-Hookean elastic cell model.
#define R2_SOFT_SOLVER_CONSTRAINTS   0
 Use the constraint-based soft-body solver.
#define R2_SOFT_SOLVER_FEM   1
 Use the finite-element solver; requires RAPIER_FEM.
#define R2_SOFT_EDGE_PLASTIC_FLOW_BOTH   0
 Edge plastic flow (R2SoftBodyMaterial::edgePlasticFlow): both a squeeze and a stretch set.
#define R2_SOFT_EDGE_PLASTIC_FLOW_COMPRESSION   1
 Edge plastic flow: only a squeeze sets; a stretched edge springs back.
#define R2_SOFT_EDGE_PLASTIC_FLOW_TENSION   2
 Edge plastic flow: only a stretch sets; a squeezed edge springs back.
#define R2_SOFT_PATCH_CONSTRAINTS_KEEP   0
 Overlap patch constraints (R2SoftRecoverySettings::overlapPatchConstraints): keep them.
#define R2_SOFT_PATCH_CONSTRAINTS_STAND_DOWN   1
 Overlap patch constraints: stand them down inside the patch.
#define R2_SOFT_PATCH_CONSTRAINTS_ALONG_NORMAL   2
 Overlap patch constraints: align them with the overlap normal.
#define R2_SOFT_FRAME   4
 Read-only body type of soft-body cluster proxies; cannot be used to construct a rigid body.

Typedefs

typedef struct R2SoftBodyMaterial R2SoftBodyMaterial
 Plain configuration data; initialize defaults, edit, then apply.
typedef struct R2SoftRecoverySettings R2SoftRecoverySettings
 Plain configuration data; initialize defaults, edit, then apply.
typedef struct R2SoftFemParameters R2SoftFemParameters
 Plain configuration data; initialize defaults, edit, then apply.
typedef struct R2SoftBodiesSettings R2SoftBodiesSettings
 Plain configuration data; initialize defaults, edit, then apply.
typedef struct R2SoftEdgeSoftness R2SoftEdgeSoftness
 Spring-coefficient override for one soft-body edge.
typedef struct R2SoftEdgeSoftnessView R2SoftEdgeSoftnessView
 Borrowed elements; count counts elements.
typedef struct R2SoftEdgeTear R2SoftEdgeTear
 Tear-resistance override for one soft-body edge.
typedef struct R2SoftEdgeTearView R2SoftEdgeTearView
 Borrowed elements; count counts elements.
typedef struct R2SoftBodyDescView R2SoftBodyDescView
 Borrowed array of soft-body descriptions.
typedef struct R2SoftBodyDesc R2SoftBodyDesc
 Copyable recipe, not an owned procedural builder.
typedef struct R2SoftBodyHandle R2SoftBodyHandle
 Copyable non-owning handle: world pointer plus entity index and generation.
typedef struct R2SoftMeshBindingDesc R2SoftMeshBindingDesc
 Non-owning deformable binding description.
typedef struct R2SoftClusterSplit R2SoftClusterSplit
 Cluster and proxy remapping after a soft-body split.
typedef struct R2SoftJointMove R2SoftJointMove
 Impulse-joint movement between rigid proxies after tearing.
typedef struct R2SoftMeshId R2SoftMeshId
 Stable identity of a live mesh within one soft body; matches Rapier's SoftMeshId.
typedef struct R2SoftMeshInfo R2SoftMeshInfo
 Mesh identity and rendering metadata.

Functions

struct R2SoftBodyMaterial r2DefaultSoftBodyMaterial (void)
 Return native default soft body material.
struct R2SoftRecoverySettings r2DefaultSoftRecoverySettings (void)
 Return native default soft recovery settings.
struct R2SoftFemParameters r2DefaultSoftFemParameters (void)
 Return native default soft fem parameters.
struct R2SoftBodiesSettings r2DefaultSoftBodiesSettings (void)
 Return native default soft bodies settings.
struct R2SoftBodyDesc r2DefaultSoftBodyDesc (void)
 Return native default soft body desc.
struct R2SoftBodyHandle r2InsertSoftBody (struct R2World *world, const struct R2SoftBodyDesc *desc)
 Consumes no caller-owned resources.
struct R2SoftMeshBindingDesc r2DefaultSoftMeshBindingDesc (void)
 Return native default soft mesh binding desc.
size_t r2SoftBodyCount (const struct R2World *world)
 Return the number of soft body objects in the world.
size_t r2SoftBodyHandles (const struct R2World *world, struct R2SoftBodyHandle *buffer, size_t capacity)
 Copy entity handles.
R2Bool r2SoftBody_Contains (struct R2SoftBodyHandle handle)
 Test whether the live world contains this soft body handle.
R2Status r2SoftBodiesSetResweepStrain (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftBodiesSettings::resweepStrain.
R2Real r2SoftBodiesResweepStrain (const struct R2World *world)
 Return the world setting documented by R2SoftBodiesSettings::resweepStrain.
R2Status r2SoftBodiesSetContactStiffening (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftBodiesSettings::contactStiffening.
R2Real r2SoftBodiesContactStiffening (const struct R2World *world)
 Return the world setting documented by R2SoftBodiesSettings::contactStiffening.
R2Status r2SoftBodiesSetMaxExtraSubsteps (struct R2World *world, size_t value)
 Set the world setting documented by R2SoftBodiesSettings::maxExtraSubsteps.
size_t r2SoftBodiesMaxExtraSubsteps (const struct R2World *world)
 Return the world setting documented by R2SoftBodiesSettings::maxExtraSubsteps.
R2Status r2RecoverySetAuthoredVelocityMargin (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::authoredVelocityMargin.
R2Status r2RecoverySetEdgeSpeculation (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::edgeSpeculation.
R2Status r2RecoverySetInvertedCellDetection (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::invertedCellDetection.
R2Status r2RecoverySetSelfCrossingDetection (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::selfCrossingDetection.
R2Status r2RecoverySetDetectionMotionGating (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::detectionMotionGating.
R2Status r2RecoverySetCrossBodyDetection (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::crossBodyDetection.
R2Status r2RecoverySetSelfStandDown (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::selfStandDown.
R2Status r2RecoverySetCrossBodyExpelGate (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::crossBodyExpelGate.
R2Status r2RecoverySetEdgeStandDown (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::edgeStandDown.
R2Status r2RecoverySetCrossingRepulsion (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::crossingRepulsion.
R2Status r2RecoverySetCrossingRepulsionGuide (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::crossingRepulsionGuide.
R2Status r2RecoverySetCrossingRepulsionSelfGuide (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::crossingRepulsionSelfGuide.
R2Status r2RecoverySetRecoveryPace (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftRecoverySettings::recoveryPace.
R2Status r2RecoverySetOverlapConstraints (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapConstraints.
R2Status r2RecoverySetOverlapRigid (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapRigid.
R2Status r2RecoverySetOverlapSkipSelfTangled (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapSkipSelfTangled.
R2Status r2RecoverySetOverlapEdgeStandDown (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapEdgeStandDown.
R2Status r2RecoverySetOverlapConstraintPace (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftRecoverySettings::overlapConstraintPace.
R2Status r2RecoverySetOverlapSkinVolume (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapSkinVolume.
R2Status r2RecoverySetOverlapKeptDepth (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftRecoverySettings::overlapKeptDepth.
R2Status r2RecoverySetOverlapSelfRegions (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapSelfRegions.
R2Status r2RecoverySetOverlapNormalPush (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapNormalPush.
R2Status r2RecoverySetOverlapMultiVolume (struct R2World *world, R2Bool value)
 Set the world setting documented by R2SoftRecoverySettings::overlapMultiVolume.
R2Status r2RecoverySetOverlapProgressMargin (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftRecoverySettings::overlapProgressMargin.
R2Status r2FemSetLinearTolerance (struct R2World *world, R2Real value)
 Set the world setting documented by R2SoftFemParameters::linearTolerance.
R2Status r2FemSetMaxLinearIterations (struct R2World *world, size_t value)
 Set the world setting documented by R2SoftFemParameters::maxLinearIterations.
R2Status r2FemSetMaxDenseDofs (struct R2World *world, size_t value)
 Set the world setting documented by R2SoftFemParameters::maxDenseDofs.
R2Status r2RemoveSoftBody (struct R2SoftBodyHandle handle)
 Remove a soft body and its associated simulation objects.
R2Status r2SoftBody_WakeUp (struct R2SoftBodyHandle handle)
 Wake the soft body and its rigid proxies.
R2Status r2FreeSoftBodyTearEvent (struct R2SoftBodyTearEvent *event)
 Release an owned soft body tear event.
struct R2SoftBodyHandle r2SoftBodyTearEvent_SoftBody (const struct R2SoftBodyTearEvent *event)
 Return the source soft-body handle for this tear event.
size_t r2SoftBodyTearEvent_Bodies (const struct R2SoftBodyTearEvent *event, struct R2SoftBodyHandle *buffer, size_t capacity)
 Copy the soft bodies the torn body is in after the tear, the one keeping the handle first: the torn body alone when nothing was split off.
struct R2ParticleDestination r2SoftBodyTearEvent_ParticleDestination (const struct R2SoftBodyTearEvent *event, uint32_t particle)
 Return the destination body and particle index for an original particle.
size_t r2SoftBodyTearEvent_TornEdges (const struct R2SoftBodyTearEvent *event, uint32_t *buffer, size_t capacity)
 Flat indices; element arity follows the corresponding Rust event field.
size_t r2SoftBodyTearEvent_TornCells (const struct R2SoftBodyTearEvent *event, uint32_t *buffer, size_t capacity)
 Flat indices; element arity follows the corresponding Rust event field.
size_t r2SoftBodyTearEvent_RemovedEdges (const struct R2SoftBodyTearEvent *event, uint32_t *buffer, size_t capacity)
 Flat indices; element arity follows the corresponding Rust event field.
size_t r2SoftBodyTearEvent_SplitParticles (const struct R2SoftBodyTearEvent *event, uint32_t *buffer, size_t capacity)
 Flat indices; element arity follows the corresponding Rust event field.
size_t r2SoftBodyTearEvent_InsertedParticles (const struct R2SoftBodyTearEvent *event, uint32_t *buffer, size_t capacity)
 Flat indices; element arity follows the corresponding Rust event field.
size_t r2SoftBodyTearEvent_PieceParticles (const struct R2SoftBodyTearEvent *event, size_t piece_index, uint32_t *buffer, size_t capacity)
 Copy the particles of the piece_index-th body of r2SoftBodyTearEvent_Bodies, as indices in the torn body after the tear (the indices the other event fields use); entry i is the piece's particle i.
size_t r2SoftBodyTearEvent_Clusters (const struct R2SoftBodyTearEvent *event, struct R2SoftClusterSplit *buffer, size_t capacity)
 Copy cluster-to-piece and rigid-proxy remapping records.
size_t r2SoftBodyTearEvent_MovedJoints (const struct R2SoftBodyTearEvent *event, struct R2SoftJointMove *buffer, size_t capacity)
 Copy impulse-joint remapping records produced by the tear.
struct R2SoftBodyTearEvent * r2SoftBody_Tear (struct R2SoftBodyHandle handle, const uint32_t *edges, size_t edge_count, const uint32_t *cells, size_t cell_count)
 Tear the selected edges and return an owned remapping event.
uint32_t r2SoftBody_AddCluster (struct R2SoftBodyHandle handle, const uint32_t *particles, size_t count)
 Create a rigid proxy cluster from the supplied particle indices and return its cluster index.
R2Status r2SoftBody_RemoveCluster (struct R2SoftBodyHandle handle, uint32_t cluster)
 Remove the selected cluster and its rigid proxy.
struct R2OptionalParticleDestination r2SoftBodyTearEvent_TryParticleDestination (const struct R2SoftBodyTearEvent *event, uint32_t particle)
 Optional particle destination after a tear.
struct R2SoftBodyTearEvent * r2CutSoftBody (struct R2SoftBodyHandle handle, const struct R2Vector *blade)
 Cut using DIM points (a segment in 2D, triangle in 3D).
struct R2Vector r2SoftBody_ParticlePosition (struct R2SoftBodyHandle handle, size_t index)
 Return the world-space position of the indexed particle.
size_t r2SoftBody_ParticlePositions (struct R2SoftBodyHandle handle, struct R2Vector *buffer, size_t capacity)
 Copy world-space particle positions.
struct R2SoftBodyMaterial r2SoftBody_Material (struct R2SoftBodyHandle handle)
 Return a copy of the soft body material parameters.
R2Status r2SoftBody_SetParticlePosition (struct R2SoftBodyHandle handle, size_t index, struct R2Vector value)
 Set the world-space position of the indexed particle.
R2Status r2SoftBody_SetMaterial (struct R2SoftBodyHandle handle, const struct R2SoftBodyMaterial *data)
 Copy material parameters into the soft body.
R2Status r2SoftBody_AddParticleForce (struct R2SoftBodyHandle handle, size_t index, struct R2Vector value, R2Bool wake_up)
 Add a world-space force to the indexed particle.
R2Status r2SoftBodyDesc_SetParticles (struct R2SoftBodyDesc *desc, struct R2VectorView positions)
 Select an explicit particle recipe and borrow its positions.
R2Status r2SoftBodyDesc_SetSurfaceMesh (struct R2SoftBodyDesc *desc, struct R2VectorView vertices, R2SurfaceElementView elements)
 Select a surface recipe and borrow its vertices and elements.
R2Status r2SoftBodyDesc_SetTrimesh (struct R2SoftBodyDesc *desc, struct R2VectorView vertices, struct R2TriangleView triangles)
 Select a 2D triangle-mesh recipe and borrow its vertices and triangles (stored in positions and cells).
R2Status r2SoftBodyDesc_SetAppended (struct R2SoftBodyDesc *desc, struct R2SoftBodyDescView view)
 Borrow descriptions to merge into this body (see R2SoftBodyDesc::appended); preserve all other fields.
R2Status r2SoftBodyDesc_SetAddedEdges (struct R2SoftBodyDesc *desc, struct R2EdgeView view)
 Borrow structural edges added after appending (see R2SoftBodyDesc::addedEdges); preserve all other fields.
R2Status r2SoftBodyDesc_SetSkin (struct R2SoftBodyDesc *desc, struct R2VectorView vertices, R2SurfaceElementView elements)
 Borrow skin geometry.
R2Status r2SoftBodyDesc_SetMasses (struct R2SoftBodyDesc *desc, struct R2RealView view)
 Borrow masses; preserve all other fields.
R2Status r2SoftBodyDesc_SetPinnedParticles (struct R2SoftBodyDesc *desc, struct R2IndexView view)
 Borrow pinned particles; preserve all other fields.
R2Status r2SoftBodyDesc_SetEdges (struct R2SoftBodyDesc *desc, struct R2EdgeView view)
 Borrow edges; preserve all other fields.
R2Status r2SoftBodyDesc_SetBendEdges (struct R2SoftBodyDesc *desc, struct R2EdgeView view)
 Borrow bend edges; preserve all other fields.
R2Status r2SoftBodyDesc_SetCells (struct R2SoftBodyDesc *desc, R2CellView view)
 Borrow cells; preserve all other fields.
R2Status r2SoftBodyDesc_SetSurface (struct R2SoftBodyDesc *desc, R2SurfaceElementView view)
 Borrow surface; preserve all other fields.
R2Status r2SoftBodyDesc_SetTensionOnlyEdges (struct R2SoftBodyDesc *desc, struct R2IndexView view)
 Borrow tension only edges; preserve all other fields.
struct R2SoftBodyDesc r2RopeSoftBodyDesc (struct R2Vector a, struct R2Vector b, size_t particles)
 Return a rope recipe with particles evenly spaced from a to b, including both endpoints.
struct R2SoftBodyDesc r2GridSoftBodyDesc (struct R2Vector center, struct R2Vector half_extents, size_t nx, size_t ny)
 Return a solid rectangle recipe on an nx by ny particle grid.
struct R2SoftBodyDesc r2PolygonSoftBodyDesc (struct R2VectorView points)
 Return a closed polygon recipe from at least 3 counter-clockwise points: structural edges along the boundary, bending edges between second neighbors, and area preservation.
struct R2SoftBodyDesc r2DiskSoftBodyDesc (struct R2Vector center, R2Real radius, size_t particles)
 Return a closed regular polygon recipe with the specified boundary particle count and area preservation.
struct R2SoftBodyDesc r2VolumetricSoftBodyDesc (struct R2VectorView vertices, R2SurfaceElementView surface, struct R2VolumeMeshParameters parameters)
 Initializes a borrowed meshing recipe.
struct R2SoftBodyMaterial r2UniformSoftBodyMaterial (struct R2SpringCoefficients value)
 Returns a material with the same softness for each constraint family.
size_t r2SoftBodyDesc_ParticlePositions (const struct R2SoftBodyDesc *desc, struct R2Vector *buffer, size_t capacity)
 Copies generated particle positions into caller-owned storage; no persistent builder.
size_t r2SoftBodyDesc_CellIndices (const struct R2SoftBodyDesc *desc, uint32_t *buffer, size_t capacity)
 Copies generated cell indices into caller-owned storage.
struct R2Vector r2SoftBody_ParticleVelocity (struct R2SoftBodyHandle handle, size_t index)
 Return the world-space velocity of the indexed particle.
uint32_t r2SoftBody_Solver (struct R2SoftBodyHandle handle)
 Return the solver simulating the soft body's elasticity (R2_SOFT_SOLVER_*).
R2Status r2SoftBody_SetClusterEdgeSoftness (struct R2SoftBodyHandle handle, uint32_t cluster, const struct R2SpringCoefficients *softness)
 Override the softness of every structural or bending edge fully contained in a live cluster: regional stiffness for cloth and ropes.
R2Status r2SoftBody_ApplyImpulseAtPoint (struct R2SoftBodyHandle handle, struct R2Vector impulse, struct R2Vector point, R2Real falloff_radius, R2Bool wake_up)
 Apply a world-space impulse to every free particle within falloff_radius of the world-space point, scaled linearly from 1 at the point to 0 at that radius and divided by the particle's mass.
R2Status r2SoftBody_ApplyRadialImpulse (struct R2SoftBodyHandle handle, struct R2Vector center, R2Real magnitude, R2Real falloff_radius, R2Bool wake_up)
 Apply an impulse of the given magnitude pointing away from the world-space center to every free particle within falloff_radius, scaled linearly from 1 at the center to 0 at that radius and divided by the particle's mass.
R2Status r2SoftBody_ResetPlasticity (struct R2SoftBodyHandle handle)
 Undo every permanent (plastic) deformation: edge rest lengths, dihedral rest angles, cell rest shapes and particle rest positions return to their creation state.
R2Status r2SoftBody_TearEdge (struct R2SoftBodyHandle handle, size_t index)
 Mark the indexed edge as torn.
R2Status r2SoftBody_TearCell (struct R2SoftBodyHandle handle, size_t index)
 Mark the indexed cell as torn.
size_t r2SoftBodyTearEvent_PieceCount (const struct R2SoftBodyTearEvent *event)
 Return the number of soft bodies the torn body is in after the tear: the length of r2SoftBodyTearEvent_Bodies, and the exclusive bound of the piece_index of r2SoftBodyTearEvent_PieceParticles.
R2Bool r2RecoveryAuthoredVelocityMargin (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::authoredVelocityMargin.
R2Bool r2RecoveryEdgeSpeculation (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::edgeSpeculation.
R2Bool r2RecoveryInvertedCellDetection (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::invertedCellDetection.
R2Bool r2RecoverySelfCrossingDetection (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::selfCrossingDetection.
R2Bool r2RecoveryDetectionMotionGating (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::detectionMotionGating.
R2Bool r2RecoveryCrossBodyDetection (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::crossBodyDetection.
R2Bool r2RecoverySelfStandDown (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::selfStandDown.
R2Bool r2RecoveryCrossBodyExpelGate (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::crossBodyExpelGate.
R2Bool r2RecoveryEdgeStandDown (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::edgeStandDown.
R2Bool r2RecoveryCrossingRepulsion (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::crossingRepulsion.
R2Bool r2RecoveryCrossingRepulsionGuide (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::crossingRepulsionGuide.
R2Bool r2RecoveryCrossingRepulsionSelfGuide (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::crossingRepulsionSelfGuide.
R2Real r2RecoveryRecoveryPace (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::recoveryPace.
R2Bool r2RecoveryOverlapConstraints (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapConstraints.
R2Bool r2RecoveryOverlapRigid (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapRigid.
R2Bool r2RecoveryOverlapSkipSelfTangled (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapSkipSelfTangled.
R2Bool r2RecoveryOverlapEdgeStandDown (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapEdgeStandDown.
R2Real r2RecoveryOverlapConstraintPace (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapConstraintPace.
uint32_t r2RecoveryOverlapPatchConstraints (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapPatchConstraints.
R2Status r2RecoverySetOverlapPatchConstraints (struct R2World *world, uint32_t value)
 Set the world setting documented by R2SoftRecoverySettings::overlapPatchConstraints.
R2Bool r2RecoveryOverlapSkinVolume (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapSkinVolume.
R2Real r2RecoveryOverlapKeptDepth (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapKeptDepth.
R2Bool r2RecoveryOverlapSelfRegions (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapSelfRegions.
R2Bool r2RecoveryOverlapNormalPush (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapNormalPush.
R2Bool r2RecoveryOverlapMultiVolume (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapMultiVolume.
uint32_t r2RecoveryOverlapSplit (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapSplit.
R2Status r2RecoverySetOverlapSplit (struct R2World *world, uint32_t value)
 Set the world setting documented by R2SoftRecoverySettings::overlapSplit.
uint32_t r2RecoveryOverlapPatience (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapPatience.
R2Status r2RecoverySetOverlapPatience (struct R2World *world, uint32_t value)
 Set the world setting documented by R2SoftRecoverySettings::overlapPatience.
R2Real r2RecoveryOverlapProgressMargin (const struct R2World *world)
 Return the world setting documented by R2SoftRecoverySettings::overlapProgressMargin.
R2Real r2FemLinearTolerance (const struct R2World *world)
 Return the world setting documented by R2SoftFemParameters::linearTolerance.
size_t r2FemMaxLinearIterations (const struct R2World *world)
 Return the world setting documented by R2SoftFemParameters::maxLinearIterations.
size_t r2FemMaxDenseDofs (const struct R2World *world)
 Return the world setting documented by R2SoftFemParameters::maxDenseDofs.
size_t r2SoftBody_NumParticles (struct R2SoftBodyHandle handle)
 Return the soft body particle count.
uint32_t r2SoftBody_TopologyVersion (struct R2SoftBodyHandle handle)
 Return a counter that changes when particle connectivity changes; use it to invalidate mesh caches.
R2Real r2SoftBody_Mass (struct R2SoftBodyHandle handle)
 Return the soft body mass.
R2Real r2SoftBody_Volume (struct R2SoftBodyHandle handle)
 Return the soft body current volume.
R2Real r2SoftBody_RestVolume (struct R2SoftBodyHandle handle)
 Return the soft body undeformed volume.
R2Real r2SoftBody_VolumeFactor (struct R2SoftBodyHandle handle)
 Return the soft body target volume multiplier.
struct R2Vector r2SoftBody_CenterOfMass (struct R2SoftBodyHandle handle)
 Return the soft body world-space center of mass.
struct R2RigidBodyHandle r2SoftBody_RootBody (struct R2SoftBodyHandle handle)
 Return the soft body root rigid-proxy handle.
R2Bool r2SoftBody_IsEnabled (struct R2SoftBodyHandle handle)
 Return whether the soft body is enabled.
R2Bool r2SoftBody_IsSleeping (struct R2SoftBodyHandle handle)
 Return whether the soft body is sleeping.
size_t r2SoftBody_ParticleVelocities (struct R2SoftBodyHandle handle, struct R2Vector *buffer, size_t capacity)
 Copy world-space particle velocities.
size_t r2SoftBody_Edges (struct R2SoftBodyHandle handle, uint32_t *buffer, size_t capacity)
 Copy flattened edge vertex indices.
size_t r2SoftBody_Cells (struct R2SoftBodyHandle handle, uint32_t *buffer, size_t capacity)
 Copy flattened cell vertex indices.
size_t r2SoftBody_Boundary (struct R2SoftBodyHandle handle, uint32_t *buffer, size_t capacity)
 Copy flattened boundary element indices.
size_t r2SoftBody_Pieces (struct R2SoftBodyHandle handle, struct R2SoftBodyHandle *buffer, size_t capacity)
 Copy piece identifiers.
R2Status r2SoftBody_SetParticleVelocity (struct R2SoftBodyHandle handle, size_t index, struct R2Vector value)
 Set the soft body particle world-space velocity.
R2Status r2SoftBody_SetParticleKinematicTarget (struct R2SoftBodyHandle handle, size_t index, struct R2Vector value)
 Set the next world-space target position of a pinned particle.
R2Status r2SoftBody_SetParticlePinned (struct R2SoftBodyHandle handle, size_t index, R2Bool value)
 Enable or disable pinning the particle for the soft body.
R2Status r2SoftBody_ApplyParticleImpulse (struct R2SoftBodyHandle handle, size_t index, struct R2Vector value, R2Bool wake_up)
 Apply a world-space impulse to one particle.
R2Status r2SoftBody_AddForce (struct R2SoftBodyHandle handle, struct R2Vector value, R2Bool wake_up)
 Accumulate a world-space force; it persists until reset.
R2Status r2SoftBody_ApplyImpulse (struct R2SoftBodyHandle handle, struct R2Vector value, R2Bool wake_up)
 Add the same world-space velocity change to every free particle: the whole body is kicked at the same velocity, whatever the particle masses (the value is not divided by the mass).
R2Status r2SoftBody_ResetForces (struct R2SoftBodyHandle handle, R2Bool wake_up)
 Clear accumulated user forces.
R2Status r2SoftBody_SetEnabled (struct R2SoftBodyHandle handle, R2Bool value)
 Enable or disable the soft body.
R2Status r2SoftBody_SetVolumeFactor (struct R2SoftBodyHandle handle, R2Real value)
 Set the soft body target volume multiplier.
R2Status r2SoftBody_AttachParticle (struct R2SoftBodyHandle handle, size_t index, struct R2RigidBodyHandle rigid_body)
 Attach a particle to a rigid body by a two-way point-to-point constraint (unlike pinning).
R2Bool r2SoftBody_DetachParticle (struct R2SoftBodyHandle handle, size_t index)
 Detach a particle from every rigid body it was attached to with r2SoftBody_AttachParticle.
size_t r2SoftBody_Clusters (struct R2SoftBodyHandle handle, uint32_t *buffer, size_t capacity)
 Copy cluster indices.
struct R2RigidBodyHandle r2SoftBody_ClusterProxy (struct R2SoftBodyHandle handle, uint32_t cluster)
 Return the rigid proxy for the selected cluster.
size_t r2SoftBody_ClusterParticles (struct R2SoftBodyHandle handle, uint32_t cluster, uint32_t *buffer, size_t capacity)
 Copy particle indices for a cluster.
R2Status r2SoftBody_SetClusterPinned (struct R2SoftBodyHandle handle, uint32_t cluster, R2Bool value)
 Enable or disable pinning the cluster for the soft body.
R2Status r2SoftBody_SetClusterKinematicTarget (struct R2SoftBodyHandle handle, uint32_t cluster, struct R2Pose value)
 Set the next world-space target pose of a pinned cluster.
R2Status r2SoftBody_SetClusterShapeMatchingEnabled (struct R2SoftBodyHandle handle, uint32_t cluster, R2Bool value)
 Enable or disable using cluster shape matching for the soft body.
R2Status r2SoftBody_SetClusterStiffnessScale (struct R2SoftBodyHandle handle, uint32_t cluster, R2Real value)
 Scale the material stiffness (Young modulus) of every cell fully contained in a live cluster: regional materials without a separate body.
R2Status r2SoftBody_SetClusterTearResistance (struct R2SoftBodyHandle handle, uint32_t cluster, R2Real value)
 Set the soft body cluster tear-resistance multiplier.
size_t r2SoftBody_Meshes (struct R2SoftBodyHandle handle, struct R2SoftMeshInfo *buffer, size_t capacity)
 Copy collision mesh metadata.
size_t r2SoftBody_MeshVerticesById (struct R2SoftBodyHandle handle, struct R2SoftMeshId id, struct R2Vector *buffer, size_t capacity)
 Copy world-space vertices for a mesh ID.
size_t r2SoftBody_MeshIndicesById (struct R2SoftBodyHandle handle, struct R2SoftMeshId id, uint32_t *buffer, size_t capacity)
 Copy flattened indices for a mesh ID.
size_t r2SoftBody_MeshColliders (struct R2SoftBodyHandle handle, struct R2ColliderHandle *buffer, size_t capacity)
 Copy collision mesh collider handles.
size_t r2SoftBody_MeshVertices (struct R2SoftBodyHandle handle, struct R2ColliderHandle collider, struct R2Vector *buffer, size_t capacity)
 Copy world-space collision mesh vertices.
size_t r2SoftBody_MeshIndices (struct R2SoftBodyHandle handle, struct R2ColliderHandle collider, uint32_t *buffer, size_t capacity)
 Copy flattened collision mesh indices.
size_t r2SoftBody_MeshArity (struct R2SoftBodyHandle handle, struct R2ColliderHandle collider)
 Return indices per collision-mesh element (2 for segments, 3 for triangles).
uint32_t r2SoftBody_MeshTopologyVersion (struct R2SoftBodyHandle handle, struct R2ColliderHandle collider)
 Return the selected collision mesh topology revision for cache invalidation.
R2Status r2SoftBody_SetSolver (struct R2SoftBodyHandle handle, uint32_t solver)
 Set the soft body soft solver kind (R2_SOFT_SOLVER_*).
R2Status r2SoftBody_SetClusterShapeMatchingTarget (struct R2SoftBodyHandle handle, uint32_t cluster, const struct R2Pose *target)
 Set the soft body cluster shape-matching target pose.
R2Status r2SoftBody_SetEdgeTearResistance (struct R2SoftBodyHandle handle, size_t index, R2Real resistance)
 Set the soft body edge tear-resistance multiplier.
R2Bool r2SoftBody_MeshIsClosed (struct R2SoftBodyHandle handle, struct R2ColliderHandle collider)
 Return whether the selected collision mesh is closed.
struct R2SoftBodyHandle r2RigidBody_SoftBody (struct R2RigidBodyHandle handle)
 Return the associated soft-body handle, or an invalid handle if this is not a soft proxy.
R2Bool r2RigidBody_IsSoftFrame (struct R2RigidBodyHandle handle)
 Return whether the rigid body is a soft-body proxy.
R2Status r2SoftBody_ValidateHandle (struct R2SoftBodyHandle handle)
 Validate the index and generation in the live owning world.

Detailed Description

Particle recipes, materials, clusters, deformable meshes, and tearing.

Mesh indices and particle indices can change after tearing; use topology versions and tear remapping events to maintain application data. FEM requires RAPIER_FEM.

Macro Definition Documentation

◆ R2_SOFT_BINDING_DIRECT

#define R2_SOFT_BINDING_DIRECT   1

Soft-body selector: binding direct.

◆ R2_SOFT_BINDING_DIRECT_BY_POSITION

#define R2_SOFT_BINDING_DIRECT_BY_POSITION   2

Soft-body selector: binding direct by position.

◆ R2_SOFT_BINDING_SKINNED

#define R2_SOFT_BINDING_SKINNED   0

Soft-body selector: binding skinned.

◆ R2_SOFT_CELL_COROTATIONAL

#define R2_SOFT_CELL_COROTATIONAL   1

Corotational elastic cell model.

◆ R2_SOFT_CELL_NEO_HOOKEAN

#define R2_SOFT_CELL_NEO_HOOKEAN   2

Neo-Hookean elastic cell model.

◆ R2_SOFT_CELL_VOLUME

#define R2_SOFT_CELL_VOLUME   0

Cell model that constrains volume without elastic shear response.

◆ R2_SOFT_DESC_CLOTH

#define R2_SOFT_DESC_CLOTH   3

Soft-body selector: desc cloth.

◆ R2_SOFT_DESC_CLOTH_TUBE

#define R2_SOFT_DESC_CLOTH_TUBE   8

Soft-body selector: desc cloth tube.

◆ R2_SOFT_DESC_CUBOID

#define R2_SOFT_DESC_CUBOID   4

Soft-body selector: desc cuboid.

◆ R2_SOFT_DESC_DISK

#define R2_SOFT_DESC_DISK   6

Soft-body selector: desc disk.

◆ R2_SOFT_DESC_GRID

#define R2_SOFT_DESC_GRID   2

Soft-body selector: desc grid.

◆ R2_SOFT_DESC_PARTICLES

#define R2_SOFT_DESC_PARTICLES   0

Soft-body selector: desc particles.

◆ R2_SOFT_DESC_POLYGON

#define R2_SOFT_DESC_POLYGON   10

Soft-body selector: closed counter-clockwise polygon of particles preserving its area (2D).

◆ R2_SOFT_DESC_ROPE

#define R2_SOFT_DESC_ROPE   1

Soft-body selector: desc rope.

◆ R2_SOFT_DESC_SPHERE

#define R2_SOFT_DESC_SPHERE   7

Soft-body selector: desc sphere.

◆ R2_SOFT_DESC_SURFACE

#define R2_SOFT_DESC_SURFACE   5

Soft-body selector: desc surface.

◆ R2_SOFT_DESC_TRIMESH

#define R2_SOFT_DESC_TRIMESH   11

Soft-body selector: triangle mesh without cells, held by shape matching (2D).

◆ R2_SOFT_DESC_VOLUMETRIC

#define R2_SOFT_DESC_VOLUMETRIC   9

Soft-body selector: desc volumetric.

◆ R2_SOFT_EDGE_PLASTIC_FLOW_BOTH

#define R2_SOFT_EDGE_PLASTIC_FLOW_BOTH   0

Edge plastic flow (R2SoftBodyMaterial::edgePlasticFlow): both a squeeze and a stretch set.

◆ R2_SOFT_EDGE_PLASTIC_FLOW_COMPRESSION

#define R2_SOFT_EDGE_PLASTIC_FLOW_COMPRESSION   1

Edge plastic flow: only a squeeze sets; a stretched edge springs back.

◆ R2_SOFT_EDGE_PLASTIC_FLOW_TENSION

#define R2_SOFT_EDGE_PLASTIC_FLOW_TENSION   2

Edge plastic flow: only a stretch sets; a squeezed edge springs back.

◆ R2_SOFT_FRAME

#define R2_SOFT_FRAME   4

Read-only body type of soft-body cluster proxies; cannot be used to construct a rigid body.

◆ R2_SOFT_PATCH_CONSTRAINTS_ALONG_NORMAL

#define R2_SOFT_PATCH_CONSTRAINTS_ALONG_NORMAL   2

Overlap patch constraints: align them with the overlap normal.

◆ R2_SOFT_PATCH_CONSTRAINTS_KEEP

#define R2_SOFT_PATCH_CONSTRAINTS_KEEP   0

Overlap patch constraints (R2SoftRecoverySettings::overlapPatchConstraints): keep them.

◆ R2_SOFT_PATCH_CONSTRAINTS_STAND_DOWN

#define R2_SOFT_PATCH_CONSTRAINTS_STAND_DOWN   1

Overlap patch constraints: stand them down inside the patch.

◆ R2_SOFT_SOLVER_CONSTRAINTS

#define R2_SOFT_SOLVER_CONSTRAINTS   0

Use the constraint-based soft-body solver.

◆ R2_SOFT_SOLVER_FEM

#define R2_SOFT_SOLVER_FEM   1

Use the finite-element solver; requires RAPIER_FEM.

Typedef Documentation

◆ R2SoftBodiesSettings

typedef struct R2SoftBodiesSettings R2SoftBodiesSettings

Plain configuration data; initialize defaults, edit, then apply.

No destructor.

◆ R2SoftBodyDesc

typedef struct R2SoftBodyDesc R2SoftBodyDesc

Copyable recipe, not an owned procedural builder.

Initialize before editing. All array views borrow caller data until build/insert returns; counts for topology arrays are element counts (edges, triangles, or tetrahedra). Nonempty topology overrides the generator's topology. Zero counts retain it. Generator inputs: a/b are rope ends or center/half-extents; cloth uses a/du/dv. R2_SOFT_DESC_POLYGON reads positions; R2_SOFT_DESC_TRIMESH reads positions and cells (its triangles become edges and a boundary, not cells).

◆ R2SoftBodyDescView

typedef struct R2SoftBodyDescView R2SoftBodyDescView

Borrowed array of soft-body descriptions.

count counts descriptions. Data must remain live through the build/insert call that reads the description. NULL is permitted only when count is zero.

◆ R2SoftBodyHandle

typedef struct R2SoftBodyHandle R2SoftBodyHandle

Copyable non-owning handle: world pointer plus entity index and generation.

The world must remain alive throughout every use. Copying does not retain it. UINT32_MAX/UINT32_MAX with a NULL world is invalid.

◆ R2SoftBodyMaterial

typedef struct R2SoftBodyMaterial R2SoftBodyMaterial

Plain configuration data; initialize defaults, edit, then apply.

No destructor.

◆ R2SoftClusterSplit

typedef struct R2SoftClusterSplit R2SoftClusterSplit

Cluster and proxy remapping after a soft-body split.

◆ R2SoftEdgeSoftness

typedef struct R2SoftEdgeSoftness R2SoftEdgeSoftness

Spring-coefficient override for one soft-body edge.

◆ R2SoftEdgeSoftnessView

typedef struct R2SoftEdgeSoftnessView R2SoftEdgeSoftnessView

Borrowed elements; count counts elements.

Data must remain live through insertion.

◆ R2SoftEdgeTear

typedef struct R2SoftEdgeTear R2SoftEdgeTear

Tear-resistance override for one soft-body edge.

◆ R2SoftEdgeTearView

typedef struct R2SoftEdgeTearView R2SoftEdgeTearView

Borrowed elements; count counts elements.

Data must remain live through insertion.

◆ R2SoftFemParameters

typedef struct R2SoftFemParameters R2SoftFemParameters

Plain configuration data; initialize defaults, edit, then apply.

No destructor.

◆ R2SoftJointMove

typedef struct R2SoftJointMove R2SoftJointMove

Impulse-joint movement between rigid proxies after tearing.

◆ R2SoftMeshBindingDesc

typedef struct R2SoftMeshBindingDesc R2SoftMeshBindingDesc

Non-owning deformable binding description.

Direct particle indices are borrowed.

◆ R2SoftMeshId

typedef struct R2SoftMeshId R2SoftMeshId

Stable identity of a live mesh within one soft body; matches Rapier's SoftMeshId.

◆ R2SoftMeshInfo

typedef struct R2SoftMeshInfo R2SoftMeshInfo

Mesh identity and rendering metadata.

A render-only mesh has an invalid collider handle.

◆ R2SoftRecoverySettings

typedef struct R2SoftRecoverySettings R2SoftRecoverySettings

Plain configuration data; initialize defaults, edit, then apply.

No destructor.

Function Documentation

◆ r2CutSoftBody()

struct R2SoftBodyTearEvent * r2CutSoftBody ( struct R2SoftBodyHandle handle,
const struct R2Vector * blade )

Cut using DIM points (a segment in 2D, triangle in 3D).

A no-op returns a null event. The optional owned event must be freed with FreeSoftBodyTearEvent.

◆ r2DefaultSoftBodiesSettings()

struct R2SoftBodiesSettings r2DefaultSoftBodiesSettings ( void )

Return native default soft bodies settings.

This POD value owns no resources.

◆ r2DefaultSoftBodyDesc()

struct R2SoftBodyDesc r2DefaultSoftBodyDesc ( void )

Return native default soft body desc.

This POD value owns no resources.

◆ r2DefaultSoftBodyMaterial()

struct R2SoftBodyMaterial r2DefaultSoftBodyMaterial ( void )

Return native default soft body material.

This POD value owns no resources.

◆ r2DefaultSoftFemParameters()

struct R2SoftFemParameters r2DefaultSoftFemParameters ( void )

Return native default soft fem parameters.

This POD value owns no resources.

◆ r2DefaultSoftMeshBindingDesc()

struct R2SoftMeshBindingDesc r2DefaultSoftMeshBindingDesc ( void )

Return native default soft mesh binding desc.

This POD value owns no resources.

◆ r2DefaultSoftRecoverySettings()

struct R2SoftRecoverySettings r2DefaultSoftRecoverySettings ( void )

Return native default soft recovery settings.

This POD value owns no resources.

◆ r2DiskSoftBodyDesc()

struct R2SoftBodyDesc r2DiskSoftBodyDesc ( struct R2Vector center,
R2Real radius,
size_t particles )

Return a closed regular polygon recipe with the specified boundary particle count and area preservation.

Initializes a recipe without allocating. Geometry is validated during preview/insertion.

◆ r2FemLinearTolerance()

R2Real r2FemLinearTolerance ( const struct R2World * world)

Return the world setting documented by R2SoftFemParameters::linearTolerance.

◆ r2FemMaxDenseDofs()

size_t r2FemMaxDenseDofs ( const struct R2World * world)

Return the world setting documented by R2SoftFemParameters::maxDenseDofs.

◆ r2FemMaxLinearIterations()

size_t r2FemMaxLinearIterations ( const struct R2World * world)

Return the world setting documented by R2SoftFemParameters::maxLinearIterations.

◆ r2FemSetLinearTolerance()

R2Status r2FemSetLinearTolerance ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftFemParameters::linearTolerance.

◆ r2FemSetMaxDenseDofs()

R2Status r2FemSetMaxDenseDofs ( struct R2World * world,
size_t value )

Set the world setting documented by R2SoftFemParameters::maxDenseDofs.

◆ r2FemSetMaxLinearIterations()

R2Status r2FemSetMaxLinearIterations ( struct R2World * world,
size_t value )

Set the world setting documented by R2SoftFemParameters::maxLinearIterations.

◆ r2FreeSoftBodyTearEvent()

R2Status r2FreeSoftBodyTearEvent ( struct R2SoftBodyTearEvent * event)

Release an owned soft body tear event.

NULL is allowed. Do not pass borrowed pointers or free the object twice.

◆ r2GridSoftBodyDesc()

struct R2SoftBodyDesc r2GridSoftBodyDesc ( struct R2Vector center,
struct R2Vector half_extents,
size_t nx,
size_t ny )

Return a solid rectangle recipe on an nx by ny particle grid.

Initializes a recipe without allocating. Geometry is validated during preview/insertion.

◆ r2InsertSoftBody()

struct R2SoftBodyHandle r2InsertSoftBody ( struct R2World * world,
const struct R2SoftBodyDesc * desc )

Consumes no caller-owned resources.

All borrowed arrays may be released on return.

◆ r2PolygonSoftBodyDesc()

struct R2SoftBodyDesc r2PolygonSoftBodyDesc ( struct R2VectorView points)

Return a closed polygon recipe from at least 3 counter-clockwise points: structural edges along the boundary, bending edges between second neighbors, and area preservation.

The points are borrowed until preview/insertion. Initializes a recipe without allocating. Geometry is validated during preview/insertion.

◆ r2RecoveryAuthoredVelocityMargin()

R2Bool r2RecoveryAuthoredVelocityMargin ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::authoredVelocityMargin.

◆ r2RecoveryCrossBodyDetection()

R2Bool r2RecoveryCrossBodyDetection ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::crossBodyDetection.

◆ r2RecoveryCrossBodyExpelGate()

R2Bool r2RecoveryCrossBodyExpelGate ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::crossBodyExpelGate.

◆ r2RecoveryCrossingRepulsion()

R2Bool r2RecoveryCrossingRepulsion ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::crossingRepulsion.

◆ r2RecoveryCrossingRepulsionGuide()

R2Bool r2RecoveryCrossingRepulsionGuide ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::crossingRepulsionGuide.

◆ r2RecoveryCrossingRepulsionSelfGuide()

R2Bool r2RecoveryCrossingRepulsionSelfGuide ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::crossingRepulsionSelfGuide.

◆ r2RecoveryDetectionMotionGating()

R2Bool r2RecoveryDetectionMotionGating ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::detectionMotionGating.

◆ r2RecoveryEdgeSpeculation()

R2Bool r2RecoveryEdgeSpeculation ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::edgeSpeculation.

◆ r2RecoveryEdgeStandDown()

R2Bool r2RecoveryEdgeStandDown ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::edgeStandDown.

◆ r2RecoveryInvertedCellDetection()

R2Bool r2RecoveryInvertedCellDetection ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::invertedCellDetection.

◆ r2RecoveryOverlapConstraintPace()

R2Real r2RecoveryOverlapConstraintPace ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapConstraintPace.

◆ r2RecoveryOverlapConstraints()

R2Bool r2RecoveryOverlapConstraints ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapConstraints.

◆ r2RecoveryOverlapEdgeStandDown()

R2Bool r2RecoveryOverlapEdgeStandDown ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapEdgeStandDown.

◆ r2RecoveryOverlapKeptDepth()

R2Real r2RecoveryOverlapKeptDepth ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapKeptDepth.

◆ r2RecoveryOverlapMultiVolume()

R2Bool r2RecoveryOverlapMultiVolume ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapMultiVolume.

◆ r2RecoveryOverlapNormalPush()

R2Bool r2RecoveryOverlapNormalPush ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapNormalPush.

◆ r2RecoveryOverlapPatchConstraints()

uint32_t r2RecoveryOverlapPatchConstraints ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapPatchConstraints.

◆ r2RecoveryOverlapPatience()

uint32_t r2RecoveryOverlapPatience ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapPatience.

◆ r2RecoveryOverlapProgressMargin()

R2Real r2RecoveryOverlapProgressMargin ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapProgressMargin.

◆ r2RecoveryOverlapRigid()

R2Bool r2RecoveryOverlapRigid ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapRigid.

◆ r2RecoveryOverlapSelfRegions()

R2Bool r2RecoveryOverlapSelfRegions ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapSelfRegions.

◆ r2RecoveryOverlapSkinVolume()

R2Bool r2RecoveryOverlapSkinVolume ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapSkinVolume.

◆ r2RecoveryOverlapSkipSelfTangled()

R2Bool r2RecoveryOverlapSkipSelfTangled ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapSkipSelfTangled.

◆ r2RecoveryOverlapSplit()

uint32_t r2RecoveryOverlapSplit ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::overlapSplit.

◆ r2RecoveryRecoveryPace()

R2Real r2RecoveryRecoveryPace ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::recoveryPace.

◆ r2RecoverySelfCrossingDetection()

R2Bool r2RecoverySelfCrossingDetection ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::selfCrossingDetection.

◆ r2RecoverySelfStandDown()

R2Bool r2RecoverySelfStandDown ( const struct R2World * world)

Return the world setting documented by R2SoftRecoverySettings::selfStandDown.

◆ r2RecoverySetAuthoredVelocityMargin()

R2Status r2RecoverySetAuthoredVelocityMargin ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::authoredVelocityMargin.

◆ r2RecoverySetCrossBodyDetection()

R2Status r2RecoverySetCrossBodyDetection ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::crossBodyDetection.

◆ r2RecoverySetCrossBodyExpelGate()

R2Status r2RecoverySetCrossBodyExpelGate ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::crossBodyExpelGate.

◆ r2RecoverySetCrossingRepulsion()

R2Status r2RecoverySetCrossingRepulsion ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::crossingRepulsion.

◆ r2RecoverySetCrossingRepulsionGuide()

R2Status r2RecoverySetCrossingRepulsionGuide ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::crossingRepulsionGuide.

◆ r2RecoverySetCrossingRepulsionSelfGuide()

R2Status r2RecoverySetCrossingRepulsionSelfGuide ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::crossingRepulsionSelfGuide.

◆ r2RecoverySetDetectionMotionGating()

R2Status r2RecoverySetDetectionMotionGating ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::detectionMotionGating.

◆ r2RecoverySetEdgeSpeculation()

R2Status r2RecoverySetEdgeSpeculation ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::edgeSpeculation.

◆ r2RecoverySetEdgeStandDown()

R2Status r2RecoverySetEdgeStandDown ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::edgeStandDown.

◆ r2RecoverySetInvertedCellDetection()

R2Status r2RecoverySetInvertedCellDetection ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::invertedCellDetection.

◆ r2RecoverySetOverlapConstraintPace()

R2Status r2RecoverySetOverlapConstraintPace ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftRecoverySettings::overlapConstraintPace.

◆ r2RecoverySetOverlapConstraints()

R2Status r2RecoverySetOverlapConstraints ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapConstraints.

◆ r2RecoverySetOverlapEdgeStandDown()

R2Status r2RecoverySetOverlapEdgeStandDown ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapEdgeStandDown.

◆ r2RecoverySetOverlapKeptDepth()

R2Status r2RecoverySetOverlapKeptDepth ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftRecoverySettings::overlapKeptDepth.

◆ r2RecoverySetOverlapMultiVolume()

R2Status r2RecoverySetOverlapMultiVolume ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapMultiVolume.

◆ r2RecoverySetOverlapNormalPush()

R2Status r2RecoverySetOverlapNormalPush ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapNormalPush.

◆ r2RecoverySetOverlapPatchConstraints()

R2Status r2RecoverySetOverlapPatchConstraints ( struct R2World * world,
uint32_t value )

Set the world setting documented by R2SoftRecoverySettings::overlapPatchConstraints.

◆ r2RecoverySetOverlapPatience()

R2Status r2RecoverySetOverlapPatience ( struct R2World * world,
uint32_t value )

Set the world setting documented by R2SoftRecoverySettings::overlapPatience.

◆ r2RecoverySetOverlapProgressMargin()

R2Status r2RecoverySetOverlapProgressMargin ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftRecoverySettings::overlapProgressMargin.

◆ r2RecoverySetOverlapRigid()

R2Status r2RecoverySetOverlapRigid ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapRigid.

◆ r2RecoverySetOverlapSelfRegions()

R2Status r2RecoverySetOverlapSelfRegions ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapSelfRegions.

◆ r2RecoverySetOverlapSkinVolume()

R2Status r2RecoverySetOverlapSkinVolume ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapSkinVolume.

◆ r2RecoverySetOverlapSkipSelfTangled()

R2Status r2RecoverySetOverlapSkipSelfTangled ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::overlapSkipSelfTangled.

◆ r2RecoverySetOverlapSplit()

R2Status r2RecoverySetOverlapSplit ( struct R2World * world,
uint32_t value )

Set the world setting documented by R2SoftRecoverySettings::overlapSplit.

◆ r2RecoverySetRecoveryPace()

R2Status r2RecoverySetRecoveryPace ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftRecoverySettings::recoveryPace.

◆ r2RecoverySetSelfCrossingDetection()

R2Status r2RecoverySetSelfCrossingDetection ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::selfCrossingDetection.

◆ r2RecoverySetSelfStandDown()

R2Status r2RecoverySetSelfStandDown ( struct R2World * world,
R2Bool value )

Set the world setting documented by R2SoftRecoverySettings::selfStandDown.

◆ r2RemoveSoftBody()

R2Status r2RemoveSoftBody ( struct R2SoftBodyHandle handle)

Remove a soft body and its associated simulation objects.

Invalidates its handle.

◆ r2RigidBody_IsSoftFrame()

R2Bool r2RigidBody_IsSoftFrame ( struct R2RigidBodyHandle handle)

Return whether the rigid body is a soft-body proxy.

◆ r2RigidBody_SoftBody()

struct R2SoftBodyHandle r2RigidBody_SoftBody ( struct R2RigidBodyHandle handle)

Return the associated soft-body handle, or an invalid handle if this is not a soft proxy.

◆ r2RopeSoftBodyDesc()

struct R2SoftBodyDesc r2RopeSoftBodyDesc ( struct R2Vector a,
struct R2Vector b,
size_t particles )

Return a rope recipe with particles evenly spaced from a to b, including both endpoints.

Initializes a recipe without allocating. Geometry is validated during preview/insertion.

◆ r2SoftBodiesContactStiffening()

R2Real r2SoftBodiesContactStiffening ( const struct R2World * world)

Return the world setting documented by R2SoftBodiesSettings::contactStiffening.

◆ r2SoftBodiesMaxExtraSubsteps()

size_t r2SoftBodiesMaxExtraSubsteps ( const struct R2World * world)

Return the world setting documented by R2SoftBodiesSettings::maxExtraSubsteps.

◆ r2SoftBodiesResweepStrain()

R2Real r2SoftBodiesResweepStrain ( const struct R2World * world)

Return the world setting documented by R2SoftBodiesSettings::resweepStrain.

◆ r2SoftBodiesSetContactStiffening()

R2Status r2SoftBodiesSetContactStiffening ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftBodiesSettings::contactStiffening.

◆ r2SoftBodiesSetMaxExtraSubsteps()

R2Status r2SoftBodiesSetMaxExtraSubsteps ( struct R2World * world,
size_t value )

Set the world setting documented by R2SoftBodiesSettings::maxExtraSubsteps.

◆ r2SoftBodiesSetResweepStrain()

R2Status r2SoftBodiesSetResweepStrain ( struct R2World * world,
R2Real value )

Set the world setting documented by R2SoftBodiesSettings::resweepStrain.

◆ r2SoftBody_AddCluster()

uint32_t r2SoftBody_AddCluster ( struct R2SoftBodyHandle handle,
const uint32_t * particles,
size_t count )

Create a rigid proxy cluster from the supplied particle indices and return its cluster index.

◆ r2SoftBody_AddForce()

R2Status r2SoftBody_AddForce ( struct R2SoftBodyHandle handle,
struct R2Vector value,
R2Bool wake_up )

Accumulate a world-space force; it persists until reset.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_AddParticleForce()

R2Status r2SoftBody_AddParticleForce ( struct R2SoftBodyHandle handle,
size_t index,
struct R2Vector value,
R2Bool wake_up )

Add a world-space force to the indexed particle.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_ApplyImpulse()

R2Status r2SoftBody_ApplyImpulse ( struct R2SoftBodyHandle handle,
struct R2Vector value,
R2Bool wake_up )

Add the same world-space velocity change to every free particle: the whole body is kicked at the same velocity, whatever the particle masses (the value is not divided by the mass).

Pinned particles ignore it. wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_ApplyImpulseAtPoint()

R2Status r2SoftBody_ApplyImpulseAtPoint ( struct R2SoftBodyHandle handle,
struct R2Vector impulse,
struct R2Vector point,
R2Real falloff_radius,
R2Bool wake_up )

Apply a world-space impulse to every free particle within falloff_radius of the world-space point, scaled linearly from 1 at the point to 0 at that radius and divided by the particle's mass.

A falloff_radius of zero or less gives every free particle the whole impulse. Pinned particles ignore it. wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_ApplyParticleImpulse()

R2Status r2SoftBody_ApplyParticleImpulse ( struct R2SoftBodyHandle handle,
size_t index,
struct R2Vector value,
R2Bool wake_up )

Apply a world-space impulse to one particle.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_ApplyRadialImpulse()

R2Status r2SoftBody_ApplyRadialImpulse ( struct R2SoftBodyHandle handle,
struct R2Vector center,
R2Real magnitude,
R2Real falloff_radius,
R2Bool wake_up )

Apply an impulse of the given magnitude pointing away from the world-space center to every free particle within falloff_radius, scaled linearly from 1 at the center to 0 at that radius and divided by the particle's mass.

A particle on the center gets nothing; a falloff_radius of zero or less pushes every free particle fully. A negative magnitude pulls toward the center. Pinned particles ignore it. wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_AttachParticle()

R2Status r2SoftBody_AttachParticle ( struct R2SoftBodyHandle handle,
size_t index,
struct R2RigidBodyHandle rigid_body )

Attach a particle to a rigid body by a two-way point-to-point constraint (unlike pinning).

The anchor is the particle's current position, expressed in the rigid body's local frame; a particle attached twice keeps both attachments. Undo it with r2SoftBody_DetachParticle.

◆ r2SoftBody_Boundary()

size_t r2SoftBody_Boundary ( struct R2SoftBodyHandle handle,
uint32_t * buffer,
size_t capacity )

Copy flattened boundary element indices.

See also
Arrays and output buffers

◆ r2SoftBody_Cells()

size_t r2SoftBody_Cells ( struct R2SoftBodyHandle handle,
uint32_t * buffer,
size_t capacity )

Copy flattened cell vertex indices.

See also
Arrays and output buffers

◆ r2SoftBody_CenterOfMass()

struct R2Vector r2SoftBody_CenterOfMass ( struct R2SoftBodyHandle handle)

Return the soft body world-space center of mass.

◆ r2SoftBody_ClusterParticles()

size_t r2SoftBody_ClusterParticles ( struct R2SoftBodyHandle handle,
uint32_t cluster,
uint32_t * buffer,
size_t capacity )

Copy particle indices for a cluster.

See also
Arrays and output buffers

◆ r2SoftBody_ClusterProxy()

struct R2RigidBodyHandle r2SoftBody_ClusterProxy ( struct R2SoftBodyHandle handle,
uint32_t cluster )

Return the rigid proxy for the selected cluster.

◆ r2SoftBody_Clusters()

size_t r2SoftBody_Clusters ( struct R2SoftBodyHandle handle,
uint32_t * buffer,
size_t capacity )

Copy cluster indices.

See also
Arrays and output buffers

◆ r2SoftBody_Contains()

R2Bool r2SoftBody_Contains ( struct R2SoftBodyHandle handle)

Test whether the live world contains this soft body handle.

A removed/stale handle returns false.

◆ r2SoftBody_DetachParticle()

R2Bool r2SoftBody_DetachParticle ( struct R2SoftBodyHandle handle,
size_t index )

Detach a particle from every rigid body it was attached to with r2SoftBody_AttachParticle.

Returns whether it was attached at all.

◆ r2SoftBody_Edges()

size_t r2SoftBody_Edges ( struct R2SoftBodyHandle handle,
uint32_t * buffer,
size_t capacity )

Copy flattened edge vertex indices.

See also
Arrays and output buffers

◆ r2SoftBody_IsEnabled()

R2Bool r2SoftBody_IsEnabled ( struct R2SoftBodyHandle handle)

Return whether the soft body is enabled.

◆ r2SoftBody_IsSleeping()

R2Bool r2SoftBody_IsSleeping ( struct R2SoftBodyHandle handle)

Return whether the soft body is sleeping.

◆ r2SoftBody_Mass()

R2Real r2SoftBody_Mass ( struct R2SoftBodyHandle handle)

Return the soft body mass.

◆ r2SoftBody_Material()

struct R2SoftBodyMaterial r2SoftBody_Material ( struct R2SoftBodyHandle handle)

Return a copy of the soft body material parameters.

◆ r2SoftBody_MeshArity()

size_t r2SoftBody_MeshArity ( struct R2SoftBodyHandle handle,
struct R2ColliderHandle collider )

Return indices per collision-mesh element (2 for segments, 3 for triangles).

◆ r2SoftBody_MeshColliders()

size_t r2SoftBody_MeshColliders ( struct R2SoftBodyHandle handle,
struct R2ColliderHandle * buffer,
size_t capacity )

Copy collision mesh collider handles.

See also
Arrays and output buffers

◆ r2SoftBody_Meshes()

size_t r2SoftBody_Meshes ( struct R2SoftBodyHandle handle,
struct R2SoftMeshInfo * buffer,
size_t capacity )

Copy collision mesh metadata.

See also
Arrays and output buffers

◆ r2SoftBody_MeshIndices()

size_t r2SoftBody_MeshIndices ( struct R2SoftBodyHandle handle,
struct R2ColliderHandle collider,
uint32_t * buffer,
size_t capacity )

Copy flattened collision mesh indices.

See also
Arrays and output buffers

◆ r2SoftBody_MeshIndicesById()

size_t r2SoftBody_MeshIndicesById ( struct R2SoftBodyHandle handle,
struct R2SoftMeshId id,
uint32_t * buffer,
size_t capacity )

Copy flattened indices for a mesh ID.

See also
Arrays and output buffers

◆ r2SoftBody_MeshIsClosed()

R2Bool r2SoftBody_MeshIsClosed ( struct R2SoftBodyHandle handle,
struct R2ColliderHandle collider )

Return whether the selected collision mesh is closed.

◆ r2SoftBody_MeshTopologyVersion()

uint32_t r2SoftBody_MeshTopologyVersion ( struct R2SoftBodyHandle handle,
struct R2ColliderHandle collider )

Return the selected collision mesh topology revision for cache invalidation.

◆ r2SoftBody_MeshVertices()

size_t r2SoftBody_MeshVertices ( struct R2SoftBodyHandle handle,
struct R2ColliderHandle collider,
struct R2Vector * buffer,
size_t capacity )

Copy world-space collision mesh vertices.

See also
Arrays and output buffers

◆ r2SoftBody_MeshVerticesById()

size_t r2SoftBody_MeshVerticesById ( struct R2SoftBodyHandle handle,
struct R2SoftMeshId id,
struct R2Vector * buffer,
size_t capacity )

Copy world-space vertices for a mesh ID.

See also
Arrays and output buffers

◆ r2SoftBody_NumParticles()

size_t r2SoftBody_NumParticles ( struct R2SoftBodyHandle handle)

Return the soft body particle count.

◆ r2SoftBody_ParticlePosition()

struct R2Vector r2SoftBody_ParticlePosition ( struct R2SoftBodyHandle handle,
size_t index )

Return the world-space position of the indexed particle.

◆ r2SoftBody_ParticlePositions()

size_t r2SoftBody_ParticlePositions ( struct R2SoftBodyHandle handle,
struct R2Vector * buffer,
size_t capacity )

Copy world-space particle positions.

See also
Arrays and output buffers

◆ r2SoftBody_ParticleVelocities()

size_t r2SoftBody_ParticleVelocities ( struct R2SoftBodyHandle handle,
struct R2Vector * buffer,
size_t capacity )

Copy world-space particle velocities.

See also
Arrays and output buffers

◆ r2SoftBody_ParticleVelocity()

struct R2Vector r2SoftBody_ParticleVelocity ( struct R2SoftBodyHandle handle,
size_t index )

Return the world-space velocity of the indexed particle.

◆ r2SoftBody_Pieces()

size_t r2SoftBody_Pieces ( struct R2SoftBodyHandle handle,
struct R2SoftBodyHandle * buffer,
size_t capacity )

Copy piece identifiers.

See also
Arrays and output buffers

◆ r2SoftBody_RemoveCluster()

R2Status r2SoftBody_RemoveCluster ( struct R2SoftBodyHandle handle,
uint32_t cluster )

Remove the selected cluster and its rigid proxy.

◆ r2SoftBody_ResetForces()

R2Status r2SoftBody_ResetForces ( struct R2SoftBodyHandle handle,
R2Bool wake_up )

Clear accumulated user forces.

wake_up = 1 wakes affected bodies; 0 preserves their sleep state.

◆ r2SoftBody_ResetPlasticity()

R2Status r2SoftBody_ResetPlasticity ( struct R2SoftBodyHandle handle)

Undo every permanent (plastic) deformation: edge rest lengths, dihedral rest angles, cell rest shapes and particle rest positions return to their creation state.

The particles stay put and spring back elastically.

◆ r2SoftBody_RestVolume()

R2Real r2SoftBody_RestVolume ( struct R2SoftBodyHandle handle)

Return the soft body undeformed volume.

◆ r2SoftBody_RootBody()

struct R2RigidBodyHandle r2SoftBody_RootBody ( struct R2SoftBodyHandle handle)

Return the soft body root rigid-proxy handle.

◆ r2SoftBody_SetClusterEdgeSoftness()

R2Status r2SoftBody_SetClusterEdgeSoftness ( struct R2SoftBodyHandle handle,
uint32_t cluster,
const struct R2SpringCoefficients * softness )

Override the softness of every structural or bending edge fully contained in a live cluster: regional stiffness for cloth and ropes.

A NULL softness restores the body material's.

◆ r2SoftBody_SetClusterKinematicTarget()

R2Status r2SoftBody_SetClusterKinematicTarget ( struct R2SoftBodyHandle handle,
uint32_t cluster,
struct R2Pose value )

Set the next world-space target pose of a pinned cluster.

◆ r2SoftBody_SetClusterPinned()

R2Status r2SoftBody_SetClusterPinned ( struct R2SoftBodyHandle handle,
uint32_t cluster,
R2Bool value )

Enable or disable pinning the cluster for the soft body.

◆ r2SoftBody_SetClusterShapeMatchingEnabled()

R2Status r2SoftBody_SetClusterShapeMatchingEnabled ( struct R2SoftBodyHandle handle,
uint32_t cluster,
R2Bool value )

Enable or disable using cluster shape matching for the soft body.

◆ r2SoftBody_SetClusterShapeMatchingTarget()

R2Status r2SoftBody_SetClusterShapeMatchingTarget ( struct R2SoftBodyHandle handle,
uint32_t cluster,
const struct R2Pose * target )

Set the soft body cluster shape-matching target pose.

◆ r2SoftBody_SetClusterStiffnessScale()

R2Status r2SoftBody_SetClusterStiffnessScale ( struct R2SoftBodyHandle handle,
uint32_t cluster,
R2Real value )

Scale the material stiffness (Young modulus) of every cell fully contained in a live cluster: regional materials without a separate body.

Cells straddling the cluster's boundary keep their stiffness; use r2SoftBody_SetClusterEdgeSoftness for edges.

◆ r2SoftBody_SetClusterTearResistance()

R2Status r2SoftBody_SetClusterTearResistance ( struct R2SoftBodyHandle handle,
uint32_t cluster,
R2Real value )

Set the soft body cluster tear-resistance multiplier.

◆ r2SoftBody_SetEdgeTearResistance()

R2Status r2SoftBody_SetEdgeTearResistance ( struct R2SoftBodyHandle handle,
size_t index,
R2Real resistance )

Set the soft body edge tear-resistance multiplier.

◆ r2SoftBody_SetEnabled()

R2Status r2SoftBody_SetEnabled ( struct R2SoftBodyHandle handle,
R2Bool value )

Enable or disable the soft body.

◆ r2SoftBody_SetMaterial()

R2Status r2SoftBody_SetMaterial ( struct R2SoftBodyHandle handle,
const struct R2SoftBodyMaterial * data )

Copy material parameters into the soft body.

◆ r2SoftBody_SetParticleKinematicTarget()

R2Status r2SoftBody_SetParticleKinematicTarget ( struct R2SoftBodyHandle handle,
size_t index,
struct R2Vector value )

Set the next world-space target position of a pinned particle.

◆ r2SoftBody_SetParticlePinned()

R2Status r2SoftBody_SetParticlePinned ( struct R2SoftBodyHandle handle,
size_t index,
R2Bool value )

Enable or disable pinning the particle for the soft body.

◆ r2SoftBody_SetParticlePosition()

R2Status r2SoftBody_SetParticlePosition ( struct R2SoftBodyHandle handle,
size_t index,
struct R2Vector value )

Set the world-space position of the indexed particle.

◆ r2SoftBody_SetParticleVelocity()

R2Status r2SoftBody_SetParticleVelocity ( struct R2SoftBodyHandle handle,
size_t index,
struct R2Vector value )

Set the soft body particle world-space velocity.

◆ r2SoftBody_SetSolver()

R2Status r2SoftBody_SetSolver ( struct R2SoftBodyHandle handle,
uint32_t solver )

Set the soft body soft solver kind (R2_SOFT_SOLVER_*).

◆ r2SoftBody_SetVolumeFactor()

R2Status r2SoftBody_SetVolumeFactor ( struct R2SoftBodyHandle handle,
R2Real value )

Set the soft body target volume multiplier.

◆ r2SoftBody_Solver()

uint32_t r2SoftBody_Solver ( struct R2SoftBodyHandle handle)

Return the solver simulating the soft body's elasticity (R2_SOFT_SOLVER_*).

Always R2_SOFT_SOLVER_CONSTRAINTS in a library built without FEM.

◆ r2SoftBody_Tear()

struct R2SoftBodyTearEvent * r2SoftBody_Tear ( struct R2SoftBodyHandle handle,
const uint32_t * edges,
size_t edge_count,
const uint32_t * cells,
size_t cell_count )

Tear the selected edges and return an owned remapping event.

Release it with r2FreeSoftBodyTearEvent.

◆ r2SoftBody_TearCell()

R2Status r2SoftBody_TearCell ( struct R2SoftBodyHandle handle,
size_t index )

Mark the indexed cell as torn.

The tear is applied at the end of the next step and reported by a tear event: no cell is removed, one of its particles splits along the plane perpendicular to the cell's principal rest stretch.

◆ r2SoftBody_TearEdge()

R2Status r2SoftBody_TearEdge ( struct R2SoftBodyHandle handle,
size_t index )

Mark the indexed edge as torn.

The tear is applied at the end of the next step and reported by a tear event; use r2SoftBody_Tear to tear immediately.

◆ r2SoftBody_TopologyVersion()

uint32_t r2SoftBody_TopologyVersion ( struct R2SoftBodyHandle handle)

Return a counter that changes when particle connectivity changes; use it to invalidate mesh caches.

◆ r2SoftBody_ValidateHandle()

R2Status r2SoftBody_ValidateHandle ( struct R2SoftBodyHandle handle)

Validate the index and generation in the live owning world.

Cannot detect a world pointer that has already been freed.

◆ r2SoftBody_Volume()

R2Real r2SoftBody_Volume ( struct R2SoftBodyHandle handle)

Return the soft body current volume.

◆ r2SoftBody_VolumeFactor()

R2Real r2SoftBody_VolumeFactor ( struct R2SoftBodyHandle handle)

Return the soft body target volume multiplier.

◆ r2SoftBody_WakeUp()

R2Status r2SoftBody_WakeUp ( struct R2SoftBodyHandle handle)

Wake the soft body and its rigid proxies.

◆ r2SoftBodyCount()

size_t r2SoftBodyCount ( const struct R2World * world)

Return the number of soft body objects in the world.

◆ r2SoftBodyDesc_CellIndices()

size_t r2SoftBodyDesc_CellIndices ( const struct R2SoftBodyDesc * desc,
uint32_t * buffer,
size_t capacity )

Copies generated cell indices into caller-owned storage.

Counts scalar indices.

See also
Arrays and output buffers

◆ r2SoftBodyDesc_ParticlePositions()

size_t r2SoftBodyDesc_ParticlePositions ( const struct R2SoftBodyDesc * desc,
struct R2Vector * buffer,
size_t capacity )

Copies generated particle positions into caller-owned storage; no persistent builder.

See also
Arrays and output buffers

◆ r2SoftBodyDesc_SetAddedEdges()

R2Status r2SoftBodyDesc_SetAddedEdges ( struct R2SoftBodyDesc * desc,
struct R2EdgeView view )

Borrow structural edges added after appending (see R2SoftBodyDesc::addedEdges); preserve all other fields.

No allocation or element reads. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetAppended()

R2Status r2SoftBodyDesc_SetAppended ( struct R2SoftBodyDesc * desc,
struct R2SoftBodyDescView view )

Borrow descriptions to merge into this body (see R2SoftBodyDesc::appended); preserve all other fields.

No allocation or element reads. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetBendEdges()

R2Status r2SoftBodyDesc_SetBendEdges ( struct R2SoftBodyDesc * desc,
struct R2EdgeView view )

Borrow bend edges; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetCells()

R2Status r2SoftBodyDesc_SetCells ( struct R2SoftBodyDesc * desc,
R2CellView view )

Borrow cells; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetEdges()

R2Status r2SoftBodyDesc_SetEdges ( struct R2SoftBodyDesc * desc,
struct R2EdgeView view )

Borrow edges; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetMasses()

R2Status r2SoftBodyDesc_SetMasses ( struct R2SoftBodyDesc * desc,
struct R2RealView view )

Borrow masses; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetParticles()

R2Status r2SoftBodyDesc_SetParticles ( struct R2SoftBodyDesc * desc,
struct R2VectorView positions )

Select an explicit particle recipe and borrow its positions.

Other fields are preserved.

◆ r2SoftBodyDesc_SetPinnedParticles()

R2Status r2SoftBodyDesc_SetPinnedParticles ( struct R2SoftBodyDesc * desc,
struct R2IndexView view )

Borrow pinned particles; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetSkin()

R2Status r2SoftBodyDesc_SetSkin ( struct R2SoftBodyDesc * desc,
struct R2VectorView vertices,
R2SurfaceElementView elements )

Borrow skin geometry.

Other fields, including skinCollision, are preserved.

◆ r2SoftBodyDesc_SetSurface()

R2Status r2SoftBodyDesc_SetSurface ( struct R2SoftBodyDesc * desc,
R2SurfaceElementView view )

Borrow surface; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetSurfaceMesh()

R2Status r2SoftBodyDesc_SetSurfaceMesh ( struct R2SoftBodyDesc * desc,
struct R2VectorView vertices,
R2SurfaceElementView elements )

Select a surface recipe and borrow its vertices and elements.

Other fields are preserved.

◆ r2SoftBodyDesc_SetTensionOnlyEdges()

R2Status r2SoftBodyDesc_SetTensionOnlyEdges ( struct R2SoftBodyDesc * desc,
struct R2IndexView view )

Borrow tension only edges; preserve all other fields.

No allocation or element reads. Zero counts retain the recipe's generated defaults at insertion, as with directly assigned views. Invalid view metadata leaves the description unchanged.

◆ r2SoftBodyDesc_SetTrimesh()

R2Status r2SoftBodyDesc_SetTrimesh ( struct R2SoftBodyDesc * desc,
struct R2VectorView vertices,
struct R2TriangleView triangles )

Select a 2D triangle-mesh recipe and borrow its vertices and triangles (stored in positions and cells).

The triangles become structural edges and a boundary, not cells, and shape matching holds the shape. Other fields are preserved.

◆ r2SoftBodyHandles()

size_t r2SoftBodyHandles ( const struct R2World * world,
struct R2SoftBodyHandle * buffer,
size_t capacity )

Copy entity handles.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_Bodies()

size_t r2SoftBodyTearEvent_Bodies ( const struct R2SoftBodyTearEvent * event,
struct R2SoftBodyHandle * buffer,
size_t capacity )

Copy the soft bodies the torn body is in after the tear, the one keeping the handle first: the torn body alone when nothing was split off.

Entry i holds the particles given by r2SoftBodyTearEvent_PieceParticles(event, i, ...).

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_Clusters()

size_t r2SoftBodyTearEvent_Clusters ( const struct R2SoftBodyTearEvent * event,
struct R2SoftClusterSplit * buffer,
size_t capacity )

Copy cluster-to-piece and rigid-proxy remapping records.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_InsertedParticles()

size_t r2SoftBodyTearEvent_InsertedParticles ( const struct R2SoftBodyTearEvent * event,
uint32_t * buffer,
size_t capacity )

Flat indices; element arity follows the corresponding Rust event field.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_MovedJoints()

size_t r2SoftBodyTearEvent_MovedJoints ( const struct R2SoftBodyTearEvent * event,
struct R2SoftJointMove * buffer,
size_t capacity )

Copy impulse-joint remapping records produced by the tear.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_ParticleDestination()

struct R2ParticleDestination r2SoftBodyTearEvent_ParticleDestination ( const struct R2SoftBodyTearEvent * event,
uint32_t particle )

Return the destination body and particle index for an original particle.

◆ r2SoftBodyTearEvent_PieceCount()

size_t r2SoftBodyTearEvent_PieceCount ( const struct R2SoftBodyTearEvent * event)

Return the number of soft bodies the torn body is in after the tear: the length of r2SoftBodyTearEvent_Bodies, and the exclusive bound of the piece_index of r2SoftBodyTearEvent_PieceParticles.

It is 1 when nothing was split off.

◆ r2SoftBodyTearEvent_PieceParticles()

size_t r2SoftBodyTearEvent_PieceParticles ( const struct R2SoftBodyTearEvent * event,
size_t piece_index,
uint32_t * buffer,
size_t capacity )

Copy the particles of the piece_index-th body of r2SoftBodyTearEvent_Bodies, as indices in the torn body after the tear (the indices the other event fields use); entry i is the piece's particle i.

piece_index must be less than r2SoftBodyTearEvent_PieceCount.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_RemovedEdges()

size_t r2SoftBodyTearEvent_RemovedEdges ( const struct R2SoftBodyTearEvent * event,
uint32_t * buffer,
size_t capacity )

Flat indices; element arity follows the corresponding Rust event field.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_SoftBody()

struct R2SoftBodyHandle r2SoftBodyTearEvent_SoftBody ( const struct R2SoftBodyTearEvent * event)

Return the source soft-body handle for this tear event.

◆ r2SoftBodyTearEvent_SplitParticles()

size_t r2SoftBodyTearEvent_SplitParticles ( const struct R2SoftBodyTearEvent * event,
uint32_t * buffer,
size_t capacity )

Flat indices; element arity follows the corresponding Rust event field.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_TornCells()

size_t r2SoftBodyTearEvent_TornCells ( const struct R2SoftBodyTearEvent * event,
uint32_t * buffer,
size_t capacity )

Flat indices; element arity follows the corresponding Rust event field.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_TornEdges()

size_t r2SoftBodyTearEvent_TornEdges ( const struct R2SoftBodyTearEvent * event,
uint32_t * buffer,
size_t capacity )

Flat indices; element arity follows the corresponding Rust event field.

See also
Arrays and output buffers

◆ r2SoftBodyTearEvent_TryParticleDestination()

struct R2OptionalParticleDestination r2SoftBodyTearEvent_TryParticleDestination ( const struct R2SoftBodyTearEvent * event,
uint32_t particle )

Optional particle destination after a tear.

Missing destinations are normal and set found to false; body/index are only written when a destination exists.

◆ r2UniformSoftBodyMaterial()

struct R2SoftBodyMaterial r2UniformSoftBodyMaterial ( struct R2SpringCoefficients value)

Returns a material with the same softness for each constraint family.

◆ r2VolumetricSoftBodyDesc()

struct R2SoftBodyDesc r2VolumetricSoftBodyDesc ( struct R2VectorView vertices,
R2SurfaceElementView surface,
struct R2VolumeMeshParameters parameters )

Initializes a borrowed meshing recipe.

Mesh generation happens on preview/insertion.