# Class RigidBodySet

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

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

- Defined in dynamics/rigid_body_set.d.ts:13

#####
Index

### Constructors

constructor

### Properties

map
raw

### Methods

contains
createRigidBody
finalizeDeserialization
forEach
forEachActiveRigidBody
free
get
getAll
len
remove

## Constructors

### constructor

- new RigidBodySet(raw?): RigidBodySet

- #### Parameters

  - `Optional` raw: RawRigidBodySet

  #### Returns RigidBodySet

  - Defined in dynamics/rigid_body_set.d.ts:20

## Properties

### `Private` map

map: any

- Defined in dynamics/rigid_body_set.d.ts:15

### raw

raw: RawRigidBodySet

- Defined in dynamics/rigid_body_set.d.ts:14

## Methods

### contains

- contains(handle): boolean

- Does this set contain a rigid-body with the given handle?

  #### Parameters

  - handle: number

    The rigid-body handle to check.

  #### Returns boolean

  - Defined in dynamics/rigid_body_set.d.ts:51

### createRigidBody

- createRigidBody(colliderSet, desc): RigidBody

- Creates a new rigid-body and return its integer handle.

  #### Parameters

  - colliderSet: ColliderSet
  - desc: RigidBodyDesc

    The description of the rigid-body to create.

  #### Returns RigidBody

  - Defined in dynamics/rigid_body_set.d.ts:30

### finalizeDeserialization

- finalizeDeserialization(colliderSet): void

- Internal method, do not call this explicitly.

  #### Parameters

  - colliderSet: ColliderSet

  #### Returns void

  - Defined in dynamics/rigid_body_set.d.ts:24

### forEach

- forEach(f): void

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

  #### Parameters

  - f: ((body) => void)

    The closure to apply.

    - - (body): void

      - #### Parameters

        - body: RigidBody

        #### Returns void

  - Defined in dynamics/rigid_body_set.d.ts:63

### forEachActiveRigidBody

- forEachActiveRigidBody(islands, f): void

- Applies the given closure to each active rigid-bodies contained by this set.

  A rigid-body is active if it is not sleeping, i.e., if it moved recently.

  #### Parameters

  - islands: IslandManager
  - f: ((body) => void)

    The closure to apply.

    - - (body): void

      - #### Parameters

        - body: RigidBody

        #### Returns void

  - Defined in dynamics/rigid_body_set.d.ts:71

### free

- free(): void

- Release the WASM memory occupied by this rigid-body set.

  #### Returns void

  - Defined in dynamics/rigid_body_set.d.ts:19

### get

- get(handle): RigidBody

- Gets the rigid-body with the given handle.

  #### Parameters

  - handle: number

    The handle of the rigid-body to retrieve.

  #### Returns RigidBody

  - Defined in dynamics/rigid_body_set.d.ts:57

### getAll

- getAll(): RigidBody[]

- Gets all rigid-bodies in the list.

  #### Returns RigidBody[]

  rigid-bodies list.

  - Defined in dynamics/rigid_body_set.d.ts:77

### len

- len(): number

- The number of rigid-bodies on this set.

  #### Returns number

  - Defined in dynamics/rigid_body_set.d.ts:45

### remove

- remove(handle, islands, colliders, impulseJoints, multibodyJoints): void

- Removes a rigid-body from this set.

  This will also remove all the colliders and joints attached to the rigid-body.

  #### Parameters

  - handle: number

    The integer handle of the rigid-body to remove.

  - islands: IslandManager
  - colliders: ColliderSet

    The set of colliders that may contain colliders attached to the removed rigid-body.

  - impulseJoints: ImpulseJointSet

    The set of impulse joints that may contain joints attached to the removed rigid-body.

  - multibodyJoints: MultibodyJointSet

    The set of multibody joints that may contain joints attached to the removed rigid-body.

  #### Returns void

  - Defined in dynamics/rigid_body_set.d.ts:41