Engine²
Open-source game engine written in C++.
Loading...
Searching...
No Matches
Physics::Component::SoftBodySettings Struct Reference

Soft body simulation settings. More...

#include <SoftBody.hpp>

Static Public Member Functions

static SoftBodySettings Default ()
 Default soft body settings.
static SoftBodySettings Cloth (float stiffness=0.5f)
 Settings optimized for cloth simulation.
static SoftBodySettings Rope (float stiffness=0.9f)
 Settings optimized for rope simulation.
static SoftBodySettings Balloon (float pressure=1000.0f)
 Settings for pressure-based soft bodies (balloons).
static SoftBodySettings Jelly ()
 Settings for jelly-like objects.

Public Attributes

uint32_t solverIterations = 5
 Number of solver iterations (higher = more accurate but slower).
float linearDamping = 0.1f
 Linear damping (velocity decay).
float maxLinearVelocity = 500.0f
 Maximum linear velocity (m/s).
float gravityFactor = 1.0f
 Gravity factor (1.0 = normal gravity).
float restitution = 0.0f
 Restitution (bounciness) [0, 1].
float friction = 0.2f
 Friction coefficient [0, 1].
float pressure = 0.0f
float edgeCompliance = 0.0f
 Edge constraint compliance (0 = rigid, higher = softer).
float shearCompliance = 0.0f
 Shear constraint compliance.
float bendCompliance = 1.0f
 Bend constraint compliance (FLT_MAX = disable bending).
float vertexRadius = 0.0f
 Vertex collision radius (for collision detection).
bool allowSleeping = true
 Allow sleeping when stable.
bool doubleSidedFaces = false
 Treat faces as double-sided for collision.

Detailed Description

Soft body simulation settings.

Member Function Documentation

◆ Balloon()

SoftBodySettings Physics::Component::SoftBodySettings::Balloon ( float pressure = 1000.0f)
inlinestatic

Settings for pressure-based soft bodies (balloons).

Parameters
pressureInternal pressure
Returns
SoftBodySettings

Uses stiff constraint values inspired by Jolt's SoftBodyCreator defaults:

  • Edge/Shear: 1.0e-4f (very stiff)
  • Bend: 1.0e-3f (stiff but allows some bending)

◆ Cloth()

SoftBodySettings Physics::Component::SoftBodySettings::Cloth ( float stiffness = 0.5f)
inlinestatic

Settings optimized for cloth simulation.

Parameters
stiffnessCloth stiffness [0, 1] (1 = stiff like canvas, 0 = very soft like silk)
Returns
SoftBodySettings

◆ Default()

SoftBodySettings Physics::Component::SoftBodySettings::Default ( )
inlinestatic

Default soft body settings.

◆ Jelly()

SoftBodySettings Physics::Component::SoftBodySettings::Jelly ( )
inlinestatic

Settings for jelly-like objects.

Returns
SoftBodySettings

◆ Rope()

SoftBodySettings Physics::Component::SoftBodySettings::Rope ( float stiffness = 0.9f)
inlinestatic

Settings optimized for rope simulation.

Parameters
stiffnessRope stiffness [0, 1]
Returns
SoftBodySettings

Member Data Documentation

◆ allowSleeping

bool Physics::Component::SoftBodySettings::allowSleeping = true

Allow sleeping when stable.

◆ bendCompliance

float Physics::Component::SoftBodySettings::bendCompliance = 1.0f

Bend constraint compliance (FLT_MAX = disable bending).

◆ doubleSidedFaces

bool Physics::Component::SoftBodySettings::doubleSidedFaces = false

Treat faces as double-sided for collision.

◆ edgeCompliance

float Physics::Component::SoftBodySettings::edgeCompliance = 0.0f

Edge constraint compliance (0 = rigid, higher = softer).

◆ friction

float Physics::Component::SoftBodySettings::friction = 0.2f

Friction coefficient [0, 1].

◆ gravityFactor

float Physics::Component::SoftBodySettings::gravityFactor = 1.0f

Gravity factor (1.0 = normal gravity).

◆ linearDamping

float Physics::Component::SoftBodySettings::linearDamping = 0.1f

Linear damping (velocity decay).

◆ maxLinearVelocity

float Physics::Component::SoftBodySettings::maxLinearVelocity = 500.0f

Maximum linear velocity (m/s).

◆ pressure

float Physics::Component::SoftBodySettings::pressure = 0.0f

Pressure for volume preservation (0 = no pressure) For balloons/inflatables: n * R * T (substance amount * gas constant * temperature)

◆ restitution

float Physics::Component::SoftBodySettings::restitution = 0.0f

Restitution (bounciness) [0, 1].

◆ shearCompliance

float Physics::Component::SoftBodySettings::shearCompliance = 0.0f

Shear constraint compliance.

◆ solverIterations

uint32_t Physics::Component::SoftBodySettings::solverIterations = 5

Number of solver iterations (higher = more accurate but slower).

◆ vertexRadius

float Physics::Component::SoftBodySettings::vertexRadius = 0.0f

Vertex collision radius (for collision detection).


The documentation for this struct was generated from the following file: