Soft Bodies
Configure deformable solid meshes and cache their tetrahedral simulation geometry.
The Softbody component uses Bezel Jolt to deform a mesh while preserving its internal structure. It attaches to objects backed by a CoreObject with vertices and triangle indices. Use Cloth for thin fabric surfaces.
Prepare a deformable object
- Create or import a triangle mesh with sensible scale. A closed, clean mesh is a useful starting point for volume deformation.
- Add Softbody in the Inspector.
- Configure mass, stiffness, and damping before running the scene.
- Click Generate Tetrahedra to generate and save the simulation geometry for the mesh and its scale.
- Save the scene and enter play mode to inspect deformation and contacts.
Generation can be expensive. The tetrahedralCache field defaults to assets/.atlas-tetrahedra. Keep this directory inside your project assets and include it when distributing the project. The cache depends on mesh geometry and scale; regenerate it after changing either.
Choose stiffness and stability
| Setting | Purpose |
|---|---|
mass | Total simulated mass |
stiffness | Resistance to edge deformation |
volumeStiffness | Resistance to volume deformation |
damping | Reduces oscillation |
friction | Contact sliding resistance |
restitution | Contact bounce |
gravityFactor | Scales gravity |
solverIterations | Solver work per step |
allowSleeping | Allows settled bodies to sleep |
isSensor and sendSignal | Sensor contact and signal configuration |
Increase stiffness gradually and compare the result against a simple rigidbody collider. More solver iterations can improve constraint convergence, but increase CPU cost. Start with a modest mesh before increasing subdivision or tetrahedral detail.
Avoid giving the same object both Rigidbody and Softbody components to drive its motion. Let the soft-body solver update the mesh instead of overwriting its transform every frame.
Configure an existing body from TypeScript
Attach this script alongside the Softbody component:
import { Component } from "atlas";
import { Softbody } from "bezel";
export class SoftbodySettings extends Component {
init(): void {
const body = this.getParent(Softbody);
body?.setMass(2);
body?.setStiffness(0.8);
body?.setVolumeStiffness(1);
body?.setDamping(0.1);
}
update(_deltaTime: number): void {}
}Use Softbody for setters and velocity queries. Cache generation is an editor workflow; tetrahedralCache is configured through the Inspector rather than the TypeScript class.