# Class ColliderSet

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).

- Defined in geometry/collider_set.d.ts:11

#####
Index

### Constructors

constructor

### Properties

map
raw

### Methods

castClosure
contains
createCollider
finalizeDeserialization
forEach
free
get
getAll
len
remove
unmap

## Constructors

### constructor

- new ColliderSet(raw?): ColliderSet

- #### Parameters

  - `Optional` raw: RawColliderSet

  #### Returns ColliderSet

  - Defined in geometry/collider_set.d.ts:18

## Properties

### `Private` map

map: any

- Defined in geometry/collider_set.d.ts:13

### raw

raw: RawColliderSet

- Defined in geometry/collider_set.d.ts:12

## Methods

### castClosure

- castClosure<Res>(f?): ((handle) => Res)
- `Internal`

  #### Type Parameters

  - Res

  #### Parameters

  - `Optional` f: ((collider) => Res)
    - - (collider): Res

      - #### Parameters

        - collider: Collider

        #### Returns Res

  #### Returns ((handle) => Res)

  - - (handle): Res

    - #### Parameters

      - handle: number

      #### Returns Res

  - Defined in geometry/collider_set.d.ts:20

### contains

- contains(handle): boolean

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

  #### Parameters

  - handle: number

    The collider handle to check.

  #### Returns boolean

  - Defined in geometry/collider_set.d.ts:59

### createCollider

- createCollider(bodies, desc, parentHandle): Collider

- 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

  - Defined in geometry/collider_set.d.ts:30

### finalizeDeserialization

- finalizeDeserialization(bodies): void
- `Internal`

  #### Parameters

  - bodies: RigidBodySet

  #### Returns void

  - Defined in geometry/collider_set.d.ts:22

### forEach

- forEach(f): void

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

  #### Parameters

  - f: ((collider) => void)

    The closure to apply.

    - - (collider): void

      - #### Parameters

        - collider: Collider

        #### Returns void

  - Defined in geometry/collider_set.d.ts:65

### free

- free(): void

- Release the WASM memory occupied by this collider set.

  #### Returns void

  - Defined in geometry/collider_set.d.ts:17

### get

- get(handle): Collider

- Gets the rigid-body with the given handle.

  #### Parameters

  - handle: number

    The handle of the rigid-body to retrieve.

  #### Returns Collider

  - Defined in geometry/collider_set.d.ts:49

### getAll

- getAll(): Collider[]

- Gets all colliders in the list.

  #### Returns Collider[]

  collider list.

  - Defined in geometry/collider_set.d.ts:71

### len

- len(): number

- The number of colliders on this set.

  #### Returns number

  - Defined in geometry/collider_set.d.ts:53

### remove

- remove(handle, islands, bodies, wakeUp): 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.

  - wakeUp: boolean

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

  #### Returns void

  - Defined in geometry/collider_set.d.ts:38

### unmap

- unmap(handle): void

- Internal function, do not call directly.

  #### Parameters

  - handle: number

  #### Returns void

  - Defined in geometry/collider_set.d.ts:43