# Class World

The physics world.

This contains all the data-structures necessary for creating and simulating bodies with contacts, joints, and external forces.

- Defined in pipeline/world.d.ts:19

#####
Index

### Constructors

constructor

### Properties

bodies
broadPhase
ccdSolver
characterControllers
colliders
debugRenderPipeline
gravity
impulseJoints
integrationParameters
islands
multibodyJoints
narrowPhase
physicsPipeline
pidControllers
serializationPipeline
vehicleControllers

### Accessors

lengthUnit
maxCcdSubsteps
numInternalPgsIterations
numSolverIterations
profilerEnabled
timestep

### Methods

castRay
castRayAndGetNormal
castShape
collidersWithAabbIntersectingAabb
contactPair
contactPairsWith
createCharacterController
createCollider
createImpulseJoint
createMultibodyJoint
createPidController
createRigidBody
createVehicleController
debugRender
forEachActiveRigidBody
forEachCollider
forEachRigidBody
free
getCollider
getImpulseJoint
getMultibodyJoint
getRigidBody
intersectionPair
intersectionPairsWith
intersectionWithShape
intersectionsWithPoint
intersectionsWithRay
intersectionsWithShape
projectPoint
projectPointAndGetFeature
propagateModifiedBodyPositionsToColliders
removeCharacterController
removeCollider
removeImpulseJoint
removeMultibodyJoint
removePidController
removeRigidBody
removeVehicleController
step
takeSnapshot
timingBroadPhase
timingCcd
timingCcdBroadPhase
timingCcdNarrowPhase
timingCcdSolver
timingCcdToiComputation
timingCollisionDetection
timingIslandConstruction
timingNarrowPhase
timingSolver
timingStep
timingUserChanges
timingVelocityAssembly
timingVelocityResolution
timingVelocityUpdate
timingVelocityWriteback
fromRaw
restoreSnapshot

## Constructors

### constructor

- new World(gravity, rawIntegrationParameters?, rawIslands?, rawBroadPhase?, rawNarrowPhase?, rawBodies?, rawColliders?, rawImpulseJoints?, rawMultibodyJoints?, rawCCDSolver?, rawPhysicsPipeline?, rawSerializationPipeline?, rawDebugRenderPipeline?): World

- #### Parameters

  - gravity: Vector
  - `Optional` rawIntegrationParameters: RawIntegrationParameters
  - `Optional` rawIslands: RawIslandManager
  - `Optional` rawBroadPhase: RawBroadPhase
  - `Optional` rawNarrowPhase: RawNarrowPhase
  - `Optional` rawBodies: RawRigidBodySet
  - `Optional` rawColliders: RawColliderSet
  - `Optional` rawImpulseJoints: RawImpulseJointSet
  - `Optional` rawMultibodyJoints: RawMultibodyJointSet
  - `Optional` rawCCDSolver: RawCCDSolver
  - `Optional` rawPhysicsPipeline: RawPhysicsPipeline
  - `Optional` rawSerializationPipeline: RawSerializationPipeline
  - `Optional` rawDebugRenderPipeline: RawDebugRenderPipeline

  #### Returns World

  - Defined in pipeline/world.d.ts:43

## Properties

### bodies

bodies: RigidBodySet

- Defined in pipeline/world.d.ts:25

### broadPhase

broadPhase: BroadPhase

- Defined in pipeline/world.d.ts:23

### ccdSolver

ccdSolver: CCDSolver

- Defined in pipeline/world.d.ts:29

### characterControllers

characterControllers: Set<KinematicCharacterController>

- Defined in pipeline/world.d.ts:33

### colliders

colliders: ColliderSet

- Defined in pipeline/world.d.ts:26

### debugRenderPipeline

debugRenderPipeline: DebugRenderPipeline

- Defined in pipeline/world.d.ts:32

### gravity

gravity: Vector

- Defined in pipeline/world.d.ts:20

### impulseJoints

impulseJoints: ImpulseJointSet

- Defined in pipeline/world.d.ts:27

### integrationParameters

integrationParameters: IntegrationParameters

- Defined in pipeline/world.d.ts:21

### islands

islands: IslandManager

- Defined in pipeline/world.d.ts:22

### multibodyJoints

multibodyJoints: MultibodyJointSet

- Defined in pipeline/world.d.ts:28

### narrowPhase

narrowPhase: NarrowPhase

- Defined in pipeline/world.d.ts:24

### physicsPipeline

physicsPipeline: PhysicsPipeline

- Defined in pipeline/world.d.ts:30

### pidControllers

pidControllers: Set<PidController>

- Defined in pipeline/world.d.ts:34

### serializationPipeline

serializationPipeline: SerializationPipeline

- Defined in pipeline/world.d.ts:31

### vehicleControllers

vehicleControllers: Set<DynamicRayCastVehicleController>

- Defined in pipeline/world.d.ts:35

## Accessors

### lengthUnit

- get lengthUnit(): number

- The approximate size of most dynamic objects in the scene.

  See the documentation of the `World.lengthUnit` setter for further details.

  #### Returns number

  - Defined in pipeline/world.d.ts:105
- set lengthUnit(unitsPerMeter): void

- The approximate size of most dynamic objects in the scene.

  This value is used internally to estimate some length-based tolerance. In particular, the values `IntegrationParameters.allowedLinearError`, `IntegrationParameters.maxPenetrationCorrection`, `IntegrationParameters.predictionDistance`, `RigidBodyActivation.linearThreshold` are scaled by this value implicitly.

  This value can be understood as the number of units-per-meter in your physical world compared to a human-sized world in meter. For example, in a 2d game, if your typical object size is 100 pixels, set the `[`Self::length_unit`]` parameter to 100.0. The physics engine will interpret it as if 100 pixels is equivalent to 1 meter in its various internal threshold. (default `1.0`).

  #### Parameters

  - unitsPerMeter: number

  #### Returns void

  - Defined in pipeline/world.d.ts:121

### maxCcdSubsteps

- get maxCcdSubsteps(): number

- The number of substeps continuous collision-detection can run (default: `1`).

  #### Returns number

  - Defined in pipeline/world.d.ts:151
- set maxCcdSubsteps(substeps): void

- Sets the number of substeps continuous collision-detection can run (default: `1`).

  CCD operates using a "motion clamping" mechanism where all fast-moving object trajectories will be truncated to their first impact on their path. The number of CCD substeps beyond 1 indicate how many times that trajectory will be updated and continued after a hit. This can results in smoother paths, but at a significant computational cost.

  #### Parameters

  - substeps: number

  #### Returns void

  - Defined in pipeline/world.d.ts:162

### numInternalPgsIterations

- get numInternalPgsIterations(): number

- Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`).

  #### Returns number

  - Defined in pipeline/world.d.ts:138
- set numInternalPgsIterations(niter): void

- Sets the Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`).

  Increasing this parameter will improve stability of the simulation. It will have a lesser effect than increasing `numSolverIterations` but is also less computationally expensive.

  #### Parameters

  - niter: number

    The new number of internal PGS iterations.

  #### Returns void

  - Defined in pipeline/world.d.ts:147

### numSolverIterations

- get numSolverIterations(): number

- The number of solver iterations run by the constraints solver for calculating forces (default: `4`).

  #### Returns number

  - Defined in pipeline/world.d.ts:125
- set numSolverIterations(niter): void

- Sets the number of solver iterations run by the constraints solver for calculating forces (default: `4`).

  The greater this value is, the most rigid and realistic the physics simulation will be. However a greater number of iterations is more computationally intensive.

  #### Parameters

  - niter: number

    The new number of solver iterations.

  #### Returns void

  - Defined in pipeline/world.d.ts:134

### profilerEnabled

- get profilerEnabled(): boolean

- Indicates if the internal performance profiling is enabled.

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns boolean

  - Defined in pipeline/world.d.ts:478
- set profilerEnabled(enabled): void

- Sets whether internal performance profiling is enabled (default: false).

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Parameters

  - enabled: boolean

  #### Returns void

  - Defined in pipeline/world.d.ts:472

### timestep

- get timestep(): number

- The current simulation timestep.

  #### Returns number

  - Defined in pipeline/world.d.ts:86
- set timestep(dt): void

- Sets the new simulation timestep.

  The simulation timestep governs by how much the physics state of the world will be integrated. A simulation timestep should:

  - be as small as possible. Typical values evolve around 0.016 (assuming the chosen unit is milliseconds, corresponds to the time between two frames of a game running at 60FPS).
  - not vary too much during the course of the simulation. A timestep with large variations may cause instabilities in the simulation.

  #### Parameters

  - dt: number

    The timestep length, in seconds.

  #### Returns void

  - Defined in pipeline/world.d.ts:99

## Methods

### castRay

- castRay(ray, maxToi, solid, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): RayColliderHit

- Find the closest intersection between a ray and the physics world.

  #### Parameters

  - ray: Ray

    The ray to cast.

  - maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray to `ray.dir.norm() * maxToi`.

  - solid: boolean

    If `false` then the ray will attempt to hit the boundary of a shape, even if its origin already lies inside of a shape. In other terms, `true` implies that all shapes are plain, whereas `false` implies that all shapes are hollow for this ray-cast.

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns RayColliderHit

  - Defined in pipeline/world.d.ts:330

### castRayAndGetNormal

- castRayAndGetNormal(ray, maxToi, solid, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): RayColliderIntersection

- Find the closest intersection between a ray and the physics world.

  This also computes the normal at the hit point.

  #### Parameters

  - ray: Ray

    The ray to cast.

  - maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray to `ray.dir.norm() * maxToi`.

  - solid: boolean

    If `false` then the ray will attempt to hit the boundary of a shape, even if its origin already lies inside of a shape. In other terms, `true` implies that all shapes are plain, whereas `false` implies that all shapes are hollow for this ray-cast.

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns RayColliderIntersection

  - Defined in pipeline/world.d.ts:343

### castShape

- castShape(shapePos, shapeRot, shapeVel, shape, targetDistance, maxToi, stopAtPenetration, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): ColliderShapeCastHit

- Casts a shape at a constant linear velocity and retrieve the first collider it hits. This is similar to ray-casting except that we are casting a whole shape instead of just a point (the ray origin).

  #### Parameters

  - shapePos: Vector

    The initial position of the shape to cast.

  - shapeRot: Rotation

    The initial rotation of the shape to cast.

  - shapeVel: Vector

    The constant velocity of the shape to cast (i.e. the cast direction).

  - shape: Shape

    The shape to cast.

  - targetDistance: number

    − If the shape moves closer to this distance from a collider, a hit will be returned.

  - maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the distance traveled by the shape to `shapeVel.norm() * maxToi`.

  - stopAtPenetration: boolean

    If set to `false`, the linear shape-cast won’t immediately stop if the shape is penetrating another shape at its starting point and its trajectory is such that it’s on a path to exit that penetration state.

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns ColliderShapeCastHit

  - Defined in pipeline/world.d.ts:418

### collidersWithAabbIntersectingAabb

- collidersWithAabbIntersectingAabb(aabbCenter, aabbHalfExtents, callback): void

- Finds the handles of all the colliders with an AABB intersecting the given AABB.

  #### Parameters

  - aabbCenter: Vector

    The center of the AABB to test.

  - aabbHalfExtents: Vector

    The half-extents of the AABB to test.

  - callback: ((handle) => boolean)

    The callback that will be called with the handles of all the colliders currently intersecting the given AABB.

    - - (handle): boolean

      - #### Parameters

        - handle: Collider

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/world.d.ts:438

### contactPair

- contactPair(collider1, collider2, f): void

- Iterates through all the contact manifolds between the given pair of colliders.

  #### Parameters

  - collider1: Collider

    The first collider involved in the contact.

  - collider2: Collider

    The second collider involved in the contact.

  - f: ((manifold, flipped) => void)

    Closure that will be called on each contact manifold between the two colliders. If the second argument passed to this closure is `true`, then the contact manifold data is flipped, i.e., methods like `localNormal1` actually apply to the `collider2` and fields like `localNormal2` apply to the `collider1`.

    - - (manifold, flipped): void

      - #### Parameters

        - manifold: TempContactManifold
        - flipped: boolean

        #### Returns void

  - Defined in pipeline/world.d.ts:460

### contactPairsWith

- contactPairsWith(collider1, f): void

- Enumerates all the colliders potentially in contact with the given collider.

  #### Parameters

  - collider1: Collider

    The second collider involved in the contact.

  - f: ((collider2) => void)

    Closure that will be called on each collider that is in contact with `collider1`.

    - - (collider2): void

      - #### Parameters

        - collider2: Collider

        #### Returns void

  - Defined in pipeline/world.d.ts:445

### createCharacterController

- createCharacterController(offset): KinematicCharacterController

- Creates a new character controller.

  #### Parameters

  - offset: number

    The artificial gap added between the character’s chape and its environment.

  #### Returns KinematicCharacterController

  - Defined in pipeline/world.d.ts:174

### createCollider

- createCollider(desc, parent?): Collider

- Creates a new collider.

  #### Parameters

  - desc: ColliderDesc

    The description of the collider.

  - `Optional` parent: RigidBody

    The rigid-body this collider is attached to.

  #### Returns Collider

  - Defined in pipeline/world.d.ts:223

### createImpulseJoint

- createImpulseJoint(params, parent1, parent2, wakeUp): ImpulseJoint

- Creates a new impulse joint from the given joint descriptor.

  #### Parameters

  - params: JointData

    The description of the joint to create.

  - parent1: RigidBody

    The first rigid-body attached to this joint.

  - parent2: RigidBody

    The second rigid-body attached to this joint.

  - wakeUp: boolean

    Should the attached rigid-bodies be awakened?

  #### Returns ImpulseJoint

  - Defined in pipeline/world.d.ts:232

### createMultibodyJoint

- createMultibodyJoint(params, parent1, parent2, wakeUp): MultibodyJoint

- Creates a new multibody joint from the given joint descriptor.

  #### Parameters

  - params: JointData

    The description of the joint to create.

  - parent1: RigidBody

    The first rigid-body attached to this joint.

  - parent2: RigidBody

    The second rigid-body attached to this joint.

  - wakeUp: boolean

    Should the attached rigid-bodies be awakened?

  #### Returns MultibodyJoint

  - Defined in pipeline/world.d.ts:241

### createPidController

- createPidController(kp, ki, kd, axes): PidController

- Creates a new PID (Proportional-Integral-Derivative) controller.

  #### Parameters

  - kp: number

    The Proportional gain applied to the instantaneous linear position errors. This is usually set to a multiple of the inverse of simulation step time (e.g. `60` if the delta-time is `1.0 / 60.0`).

  - ki: number

    The linear gain applied to the Integral part of the PID controller.

  - kd: number

    The Derivative gain applied to the instantaneous linear velocity errors. This is usually set to a value in `[0.0, 1.0]` where `0.0` implies no damping (no correction of velocity errors) and `1.0` implies complete damping (velocity errors are corrected in a single simulation step).

  - axes: PidAxesMask

    The axes affected by this controller. Only coordinate axes with a bit flags set to `true` will be taken into account when calculating the errors and corrections.

  #### Returns PidController

  - Defined in pipeline/world.d.ts:196

### createRigidBody

- createRigidBody(body): RigidBody

- Creates a new rigid-body from the given rigid-body descriptor.

  #### Parameters

  - body: RigidBodyDesc

    The description of the rigid-body to create.

  #### Returns RigidBody

  - Defined in pipeline/world.d.ts:168

### createVehicleController

- createVehicleController(chassis): DynamicRayCastVehicleController

- Creates a new vehicle controller.

  #### Parameters

  - chassis: RigidBody

    The rigid-body used as the chassis of the vehicle controller. When the vehicle controller is updated, it will change directly the rigid-body’s velocity. This rigid-body must be a dynamic or kinematic-velocity-based rigid-body.

  #### Returns DynamicRayCastVehicleController

  - Defined in pipeline/world.d.ts:210

### debugRender

- debugRender(filterFlags?, filterPredicate?): DebugRenderBuffers

- Computes all the lines (and their colors) needed to render the scene.

  #### Parameters

  - `Optional` filterFlags: QueryFilterFlags

    Flags for excluding whole subsets of colliders from rendering.

  - `Optional` filterPredicate: ((collider) => boolean)

    Any collider for which this closure returns `false` will be excluded from the debug rendering.

    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns DebugRenderBuffers

  - Defined in pipeline/world.d.ts:65

### forEachActiveRigidBody

- forEachActiveRigidBody(f): void

- Applies the given closure to each active rigid-body managed by this physics world.

  After a short time of inactivity, a rigid-body is automatically deactivated ("asleep") by the physics engine in order to save computational power. A sleeping rigid-body never moves unless it is moved manually by the user.

  #### Parameters

  - f: ((body) => void)

    The function to apply to each active rigid-body managed by this physics world. Called as `f(collider)`.

    - - (body): void

      - #### Parameters

        - body: RigidBody

        #### Returns void

  - Defined in pipeline/world.d.ts:317

### forEachCollider

- forEachCollider(f): void

- Applies the given closure to each collider managed by this physics world.

  #### Parameters

  - f: ((collider) => void)
    - - (collider): void

      - #### Parameters

        - collider: Collider

        #### Returns void

  - Defined in pipeline/world.d.ts:301

### forEachRigidBody

- forEachRigidBody(f): void

- Applies the given closure to each rigid-body managed by this physics world.

  #### Parameters

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

      - #### Parameters

        - body: RigidBody

        #### Returns void

  - Defined in pipeline/world.d.ts:307

### free

- free(): void

- Release the WASM memory occupied by this physics world.

  All the fields of this physics world will be freed as well, so there is no need to call their `.free()` methods individually.

  #### Returns void

  - Defined in pipeline/world.d.ts:42

### getCollider

- getCollider(handle): Collider

- Retrieves a collider from its handle.

  #### Parameters

  - handle: number

    The integer handle of the collider to retrieve.

  #### Returns Collider

  - Defined in pipeline/world.d.ts:253

### getImpulseJoint

- getImpulseJoint(handle): ImpulseJoint

- Retrieves an impulse joint from its handle.

  #### Parameters

  - handle: number

    The integer handle of the impulse joint to retrieve.

  #### Returns ImpulseJoint

  - Defined in pipeline/world.d.ts:259

### getMultibodyJoint

- getMultibodyJoint(handle): MultibodyJoint

- Retrieves an multibody joint from its handle.

  #### Parameters

  - handle: number

    The integer handle of the multibody joint to retrieve.

  #### Returns MultibodyJoint

  - Defined in pipeline/world.d.ts:265

### getRigidBody

- getRigidBody(handle): RigidBody

- Retrieves a rigid-body from its handle.

  #### Parameters

  - handle: number

    The integer handle of the rigid-body to retrieve.

  #### Returns RigidBody

  - Defined in pipeline/world.d.ts:247

### intersectionPair

- intersectionPair(collider1, collider2): boolean

- Returns `true` if `collider1` and `collider2` intersect and at least one of them is a sensor.

  #### Parameters

  - collider1: Collider

    − The first collider involved in the intersection.

  - collider2: Collider

    − The second collider involved in the intersection.

  #### Returns boolean

  - Defined in pipeline/world.d.ts:466

### intersectionPairsWith

- intersectionPairsWith(collider1, f): void

- Enumerates all the colliders intersecting the given colliders, assuming one of them is a sensor.

  #### Parameters

  - collider1: Collider
  - f: ((collider2) => void)
    - - (collider2): void

      - #### Parameters

        - collider2: Collider

        #### Returns void

  - Defined in pipeline/world.d.ts:450

### intersectionWithShape

- intersectionWithShape(shapePos, shapeRot, shape, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): Collider

- Gets the handle of up to one collider intersecting the given shape.

  #### Parameters

  - shapePos: Vector

    The position of the shape used for the intersection test.

  - shapeRot: Rotation

    The orientation of the shape used for the intersection test.

  - shape: Shape

    The shape used for the intersection test.

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns Collider

  - Defined in pipeline/world.d.ts:367

### intersectionsWithPoint

- intersectionsWithPoint(point, callback, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): void

- Find all the colliders containing the given point.

  #### Parameters

  - point: Vector

    The point used for the containment test.

  - callback: ((handle) => boolean)

    A function called with the handles of each collider with a shape containing the `point`.

    - - (handle): boolean

      - #### Parameters

        - handle: Collider

        #### Returns boolean

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/world.d.ts:398

### intersectionsWithRay

- intersectionsWithRay(ray, maxToi, solid, callback, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): void

- Cast a ray and collects all the intersections between a ray and the scene.

  #### Parameters

  - ray: Ray

    The ray to cast.

  - maxToi: number

    The maximum time-of-impact that can be reported by this cast. This effectively limits the length of the ray to `ray.dir.norm() * maxToi`.

  - solid: boolean

    If `false` then the ray will attempt to hit the boundary of a shape, even if its origin already lies inside of a shape. In other terms, `true` implies that all shapes are plain, whereas `false` implies that all shapes are hollow for this ray-cast.

  - callback: ((intersect) => boolean)

    The callback called once per hit (in no particular order) between a ray and a collider. If this callback returns `false`, then the cast will stop and no further hits will be detected/reported.

    - - (intersect): boolean

      - #### Parameters

        - intersect: RayColliderIntersection

        #### Returns boolean

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/world.d.ts:357

### intersectionsWithShape

- intersectionsWithShape(shapePos, shapeRot, shape, callback, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): void

- Retrieve all the colliders intersecting the given shape.

  #### Parameters

  - shapePos: Vector

    The position of the shape to test.

  - shapeRot: Rotation

    The orientation of the shape to test.

  - shape: Shape

    The shape to test.

  - callback: ((collider) => boolean)

    A function called with the handles of each collider intersecting the `shape`.

    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns void

  - Defined in pipeline/world.d.ts:429

### projectPoint

- projectPoint(point, solid, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): PointColliderProjection

- Find the projection of a point on the closest collider.

  #### Parameters

  - point: Vector

    The point to project.

  - solid: boolean

    If this is set to `true` then the collider shapes are considered to be plain (if the point is located inside of a plain shape, its projection is the point itself). If it is set to `false` the collider shapes are considered to be hollow (if the point is located inside of an hollow shape, it is projected on the shape's boundary).

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns PointColliderProjection

  - Defined in pipeline/world.d.ts:380

### projectPointAndGetFeature

- projectPointAndGetFeature(point, filterFlags?, filterGroups?, filterExcludeCollider?, filterExcludeRigidBody?, filterPredicate?): PointColliderProjection

- Find the projection of a point on the closest collider.

  #### Parameters

  - point: Vector

    The point to project.

  - `Optional` filterFlags: QueryFilterFlags
  - `Optional` filterGroups: number
  - `Optional` filterExcludeCollider: Collider
  - `Optional` filterExcludeRigidBody: RigidBody
  - `Optional` filterPredicate: ((collider) => boolean)
    - - (collider): boolean

      - #### Parameters

        - collider: Collider

        #### Returns boolean

  #### Returns PointColliderProjection

  - Defined in pipeline/world.d.ts:388

### propagateModifiedBodyPositionsToColliders

- propagateModifiedBodyPositionsToColliders(): void

- Update colliders positions after rigid-bodies moved.

  When a rigid-body moves, the positions of the colliders attached to it need to be updated. This update is generally automatically done at the beginning and the end of each simulation step with World.step. If the positions need to be updated without running a simulation step this method can be called manually.

  #### Returns void

  - Defined in pipeline/world.d.ts:82

### removeCharacterController

- removeCharacterController(controller): void

- Removes a character controller from this world.

  #### Parameters

  - controller: KinematicCharacterController

    The character controller to remove.

  #### Returns void

  - Defined in pipeline/world.d.ts:180

### removeCollider

- removeCollider(collider, wakeUp): void

- Removes the given collider from this physics world.

  #### Parameters

  - collider: Collider

    The collider to remove.

  - wakeUp: boolean

    If set to `true`, the rigid-body this collider is attached to will be awaken.

  #### Returns void

  - Defined in pipeline/world.d.ts:281

### removeImpulseJoint

- removeImpulseJoint(joint, wakeUp): void

- Removes the given impulse joint from this physics world.

  #### Parameters

  - joint: ImpulseJoint

    The impulse joint to remove.

  - wakeUp: boolean

    If set to `true`, the rigid-bodies attached by this joint will be awaken.

  #### Returns void

  - Defined in pipeline/world.d.ts:288

### removeMultibodyJoint

- removeMultibodyJoint(joint, wakeUp): void

- Removes the given multibody joint from this physics world.

  #### Parameters

  - joint: MultibodyJoint

    The multibody joint to remove.

  - wakeUp: boolean

    If set to `true`, the rigid-bodies attached by this joint will be awaken.

  #### Returns void

  - Defined in pipeline/world.d.ts:295

### removePidController

- removePidController(controller): void

- Removes a PID controller from this world.

  #### Parameters

  - controller: PidController

    The PID controller to remove.

  #### Returns void

  - Defined in pipeline/world.d.ts:202

### removeRigidBody

- removeRigidBody(body): void

- Removes the given rigid-body from this physics world.

  This will remove this rigid-body as well as all its attached colliders and joints. Every other bodies touching or attached by joints to this rigid-body will be woken-up.

  #### Parameters

  - body: RigidBody

    The rigid-body to remove.

  #### Returns void

  - Defined in pipeline/world.d.ts:274

### removeVehicleController

- removeVehicleController(controller): void

- Removes a vehicle controller from this world.

  #### Parameters

  - controller: DynamicRayCastVehicleController

    The vehicle controller to remove.

  #### Returns void

  - Defined in pipeline/world.d.ts:216

### step

- step(eventQueue?, hooks?): void

- Advance the simulation by one time step.

  All events generated by the physics engine are ignored.

  #### Parameters

  - `Optional` eventQueue: EventQueue
  - `Optional` hooks: PhysicsHooks

  #### Returns void

  - Defined in pipeline/world.d.ts:74

### takeSnapshot

- takeSnapshot(): Uint8Array

- Takes a snapshot of this world.

  Use `World.restoreSnapshot` to create a new physics world with a state identical to the state when `.takeSnapshot()` is called.

  #### Returns Uint8Array

  - Defined in pipeline/world.d.ts:51

### timingBroadPhase

- timingBroadPhase(): number

- The time spent in milliseconds by the last step to run the broad-phase.

  This timing is included in `timingCollisionDetection`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:498

### timingCcd

- timingCcd(): number

- The total time spent in CCD detection and resolution.

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:549

### timingCcdBroadPhase

- timingCcdBroadPhase(): number

- The total time spent in the broad-phase during CCD.

  This timing is included in `timingCcd`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:563

### timingCcdNarrowPhase

- timingCcdNarrowPhase(): number

- The total time spent in the narrow-phase during CCD.

  This timing is included in `timingCcd`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:570

### timingCcdSolver

- timingCcdSolver(): number

- The total time spent in the constraints resolution during CCD.

  This timing is included in `timingCcd`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:577

### timingCcdToiComputation

- timingCcdToiComputation(): number

- The total time spent searching for the continuous hits during CCD.

  This timing is included in `timingCcd`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:556

### timingCollisionDetection

- timingCollisionDetection(): number

- The time spent in milliseconds by the last step to run the collision-detection (broad-phase + narrow-phase).

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:491

### timingIslandConstruction

- timingIslandConstruction(): number

- The total time spent in the islands calculation during CCD.

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:583

### timingNarrowPhase

- timingNarrowPhase(): number

- The time spent in milliseconds by the last step to run the narrow-phase.

  This timing is included in `timingCollisionDetection`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:505

### timingSolver

- timingSolver(): number

- The time spent in milliseconds by the last step to run the constraint solver.

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:511

### timingStep

- timingStep(): number

- The time spent in milliseconds by the last step to run the entire simulation step.

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:484

### timingUserChanges

- timingUserChanges(): number

- The total time spent propagating detected user changes.

  Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:589

### timingVelocityAssembly

- timingVelocityAssembly(): number

- The time spent in milliseconds by the last step to run the constraint initialization.

  This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:519

### timingVelocityResolution

- timingVelocityResolution(): number

- The time spent in milliseconds by the last step to run the constraint resolution.

  This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:527

### timingVelocityUpdate

- timingVelocityUpdate(): number

- The time spent in milliseconds by the last step to run the rigid-body velocity update.

  This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:535

### timingVelocityWriteback

- timingVelocityWriteback(): number

- The time spent in milliseconds by writing rigid-body velocities calculated by the solver back into the rigid-bodies.

  This timing is included in `timingSolver`. Only works if the internal profiler is enabled with `World.profilerEnabled = true`.

  #### Returns number

  - Defined in pipeline/world.d.ts:543

### `Static` fromRaw

- fromRaw(raw): World

- #### Parameters

  - raw: RawDeserializedWorld

  #### Returns World

  - Defined in pipeline/world.d.ts:44

### `Static` restoreSnapshot

- restoreSnapshot(data): World

- Creates a new physics world from a snapshot.

  This new physics world will be an identical copy of the snapshoted physics world.

  #### Parameters

  - data: Uint8Array

  #### Returns World

  - Defined in pipeline/world.d.ts:57