Atlas Engine

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

  1. Create or import a triangle mesh with sensible scale. A closed, clean mesh is a useful starting point for volume deformation.
  2. Add Softbody in the Inspector.
  3. Configure mass, stiffness, and damping before running the scene.
  4. Click Generate Tetrahedra to generate and save the simulation geometry for the mesh and its scale.
  5. 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

SettingPurpose
massTotal simulated mass
stiffnessResistance to edge deformation
volumeStiffnessResistance to volume deformation
dampingReduces oscillation
frictionContact sliding resistance
restitutionContact bounce
gravityFactorScales gravity
solverIterationsSolver work per step
allowSleepingAllows settled bodies to sleep
isSensor and sendSignalSensor 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.

On this page