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

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

Constructors

  • Parameters

    • Optional raw: RawColliderSet

    Returns ColliderSet

Properties

map: any
raw: RawColliderSet

Methods

  • Internal

    Type Parameters

    • Res

    Parameters

    • Optional f: ((collider) => Res)

    Returns ((handle) => Res)

      • (handle): Res
      • Parameters

        • handle: number

        Returns Res

  • Does this set contain a collider with the given handle?

    Parameters

    • handle: number

      The collider handle to check.

    Returns boolean

  • Creates a new collider and return its integer handle.

    Parameters

    • bodies: RigidBodySet

      The set of bodies where the collider's parent can be found.

    • desc: ColliderDesc

      The collider's description.

    • parentHandle: number

      The integer handle of the rigid-body this collider is attached to.

    Returns Collider

  • Creates a collider holding a soft body's deformable collision mesh: a polyline (2D) or a triangle mesh (3D) built with the DEFORMABLE flag, whose vertices follow the cluster of the parent proxy through binding.

    Returns null when the binding fails: the parent is not a live cluster proxy, the shape is not a deformable mesh, or a vertex could not be bound.

    Parameters

    • bodies: RigidBodySet

      The set of bodies where the parent proxy can be found.

    • softBodies: SoftBodySet

      The set of soft bodies owning the cluster.

    • desc: ColliderDesc

      The collider's description.

    • binding: SoftMeshBinding

      How the mesh follows the cluster.

    • parentHandle: number

      The handle of the cluster proxy (see SoftBody.rootBody, SoftBody.clusterProxy).

    Returns Collider

  • Internal

    Parameters

    Returns void

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

    Parameters

    • f: ((collider) => void)

      The closure to apply.

        • (collider): void
        • Parameters

          Returns void

    Returns void

  • Release the WASM memory occupied by this collider set.

    Returns void

  • Gets the rigid-body with the given handle.

    Parameters

    • handle: number

      The handle of the rigid-body to retrieve.

    Returns Collider

  • Gets all colliders in the list.

    Returns Collider[]

    collider list.

  • The number of colliders on this set.

    Returns number

  • Wraps the colliders the engine created on its own (the deformable collision meshes of soft bodies) that have no JavaScript wrapper yet.

    Parameters

    Returns void

  • Remove a collider from this set.

    Parameters

    • handle: number

      The integer handle of the collider to remove.

    • islands: IslandManager
    • bodies: RigidBodySet

      The set of rigid-body containing the rigid-body the collider is attached to.

    • softBodies: SoftBodySet
    • wakeUp: boolean

      If true, the rigid-body the removed collider is attached to will be woken-up automatically.

    Returns void

  • Internal function, do not call directly.

    Parameters

    • handle: number

    Returns void

  • Drops the wrappers of the colliders the engine removed on its own (the colliders of removed soft bodies and clusters).

    Returns void