Menu
Lumberyard
Developer Guide (Version 1.11)

Soft Entity-Specific Functions

There are two types of soft entities: mesh-based and tetrahedral lattice-based. Mesh based entities use a soft, constraint-like solver and are typically cloth objects. Tetrahedral lattice-based entities use a spring solver and are typically jelly-like objects.

The longest edges of all triangles can optionally be discarded with the sef_skip_longest_edges flag.

Collisions are handled at the vertex level only (although vertices have a customizable thickness) and work best against primitive geometries rather than meshes.

pe_params_softbody

This is the main structure to set up a working soft entity (another one is pe_simulation_params).

Thickness

The thickness of the soft entity is the collision size of vertices (they are therefore treated as spheres). If an edge differs from the original length by more than maxSafeStep, positional length enforcement occurs.

Damping

Spring damping is defined with kdRatio as a ratio to a critically damped value (overall damping from pe_simulation_params is also supported).

Wind

Soft entities react to wind if airResistance is not 0 (if wind is 0, having non-zero airResistance would mean that the entity will look like it is additionally damped - air resistance will attempt to even surface velocity with air velocity).

Water

Soft entities react to water in the same way that they react to wind, but the parameters specified in pe_params_buoyancy are used instead. Note that the Archimedean force that acts on vertices submerged in the water will depend on the entity's density which should be defined explicitly in pe_simulation_params (dependence will be same as for rigid bodies - the force will be 0 if waterDensity is equal to density). collTypes enables collisions with entities of a particular simulation type using ent_ masks.

pe_action_attach_points

Can be used to attach some of a soft entity's vertices to another physical entity.

piVtx specifies vertex indices.

points specify attachment positions in world space. If points values are not specified, current vertex positions are the attachment points.