A set of soft bodies that can be handled by a physics pipeline.

To avoid leaking WASM resources, this MUST be freed manually with softBodySet.free() once you are done using it (and all the soft bodies it created).

Constructors

  • Parameters

    • Optional raw: RawSoftBodySet

    Returns SoftBodySet

Properties

finishTopologyChange: any

Maps the soft bodies, proxies and colliders a topology change created, and unmaps what it removed.

map: any
raw: RawSoftBodySet

Methods

  • Adds a cluster over the given particles: a rigid proxy that joints and colliders can attach to. Returns the cluster's index, or null if no particle was valid.

    Parameters

    Returns number

  • Does this set contain a soft body with the given handle?

    Parameters

    • handle: number

    Returns boolean

  • Creates a new soft body, its hidden root rigid body and its colliders, and returns it.

    Parameters

    • bodies: RigidBodySet

      The set of rigid bodies receiving the body's proxies.

    • colliders: ColliderSet

      The set of colliders receiving the body's colliders.

    • desc: SoftBodyDesc

      The description of the soft body to create.

    Returns SoftBody

  • Cuts a soft body along a blade: a segment (two points) in 2D, a triangle (three points) in 3D. Pieces disconnected by the cut become soft bodies of their own.

    Returns the tear event (which must be freed), or null when nothing changed.

    Parameters

    Returns SoftBodyTearEvent

  • Internal method, do not call this explicitly.

    Parameters

    Returns void

  • Applies the given closure to each soft body contained by this set.

    Parameters

    • f: ((body) => void)
        • (body): void
        • Parameters

          Returns void

    Returns void

  • Release the WASM memory occupied by this soft-body set.

    Returns void

  • Gets the soft body with the given handle.

    Parameters

    • handle: number

    Returns SoftBody

  • Gets all soft bodies in the list.

    Returns SoftBody[]

  • The number of soft bodies on this set.

    Returns number

  • Wraps the soft bodies the engine created (the pieces a tear split off) that have no JavaScript wrapper yet; the pieces of a tear event are only reachable after this.

    Parameters

    Returns void

  • Removes a soft body from this set, with its proxies, colliders and attached joints.

    Parameters

    Returns void

  • Removes a cluster with its proxy, colliders and joints. Returns false if the cluster did not exist.

    Parameters

    Returns boolean

  • Tears a soft body at once along the given edges and through the given cells, without removing material. Pieces disconnected by the tear become soft bodies of their own.

    Returns the tear event (which must be freed), or null when nothing changed.

    Parameters

    Returns SoftBodyTearEvent

  • Wakes a soft body and everything it touches up.

    Parameters

    • handle: number
    • bodies: RigidBodySet
    • strong: boolean

      If true the bodies stay awake for a while even if they are at rest.

    Returns void