Options
All
  • Public
  • Public/Protected
  • All
Menu

Class World

The physics world. The physics world.

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

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

Hierarchy

  • World

Index

Constructors

constructor

  • new World(gravity: Vector, rawIntegrationParameters?: RawIntegrationParameters, rawIslands?: RawIslandManager, rawBroadPhase?: RawBroadPhase, rawNarrowPhase?: RawNarrowPhase, rawBodies?: RawRigidBodySet, rawColliders?: RawColliderSet, rawJoints?: RawJointSet, rawCCDSolver?: RawCCDSolver, rawQueryPipeline?: RawQueryPipeline, rawPhysicsPipeline?: RawPhysicsPipeline, rawSerializationPipeline?: RawSerializationPipeline): World
  • new World(gravity: Vector, rawIntegrationParameters?: RawIntegrationParameters, rawIslands?: RawIslandManager, rawBroadPhase?: RawBroadPhase, rawNarrowPhase?: RawNarrowPhase, rawBodies?: RawRigidBodySet, rawColliders?: RawColliderSet, rawJoints?: RawJointSet, rawCCDSolver?: RawCCDSolver, rawQueryPipeline?: RawQueryPipeline, rawPhysicsPipeline?: RawPhysicsPipeline, rawSerializationPipeline?: RawSerializationPipeline): World
  • Parameters

    • gravity: Vector
    • Optional rawIntegrationParameters: RawIntegrationParameters
    • Optional rawIslands: RawIslandManager
    • Optional rawBroadPhase: RawBroadPhase
    • Optional rawNarrowPhase: RawNarrowPhase
    • Optional rawBodies: RawRigidBodySet
    • Optional rawColliders: RawColliderSet
    • Optional rawJoints: RawJointSet
    • Optional rawCCDSolver: RawCCDSolver
    • Optional rawQueryPipeline: RawQueryPipeline
    • Optional rawPhysicsPipeline: RawPhysicsPipeline
    • Optional rawSerializationPipeline: RawSerializationPipeline

    Returns World

  • Parameters

    • gravity: Vector
    • Optional rawIntegrationParameters: RawIntegrationParameters
    • Optional rawIslands: RawIslandManager
    • Optional rawBroadPhase: RawBroadPhase
    • Optional rawNarrowPhase: RawNarrowPhase
    • Optional rawBodies: RawRigidBodySet
    • Optional rawColliders: RawColliderSet
    • Optional rawJoints: RawJointSet
    • Optional rawCCDSolver: RawCCDSolver
    • Optional rawQueryPipeline: RawQueryPipeline
    • Optional rawPhysicsPipeline: RawPhysicsPipeline
    • Optional rawSerializationPipeline: RawSerializationPipeline

    Returns World

Properties

bodies

bodies: RigidBodySet

broadPhase

broadPhase: BroadPhase

ccdSolver

ccdSolver: CCDSolver

colliders

colliders: ColliderSet

gravity

gravity: Vector

integrationParameters

integrationParameters: IntegrationParameters

islands

islands: IslandManager

joints

joints: JointSet

narrowPhase

narrowPhase: NarrowPhase

physicsPipeline

physicsPipeline: PhysicsPipeline

queryPipeline

queryPipeline: QueryPipeline

serializationPipeline

serializationPipeline: SerializationPipeline

Accessors

maxPositionIterations

  • get maxPositionIterations(): number
  • set maxPositionIterations(niter: number): any
  • The maximum position iterations the position-based constraint regularization solver can make.

    The greater this value is, the less penetrations will be visible after one timestep where the velocity solver did not converge entirely. Large values will degrade significantly the performance of the simulation.

    To increase realism of the simulation it is recommended, more efficient, and more effecive, to increase the number of velocity iterations instead of this number of position iterations.

    The greater this value is, the less penetrations will be visible after one timestep where the velocity solver did not converge entirely. Large values will degrade significantly the performance of the simulation.

    To increase realism of the simulation it is recommended, more efficient, and more effecive, to increase the number of velocity iterations instead of this number of position iterations.

    Returns number

  • Sets the maximum number of position iterations (default: 1).

    The greater this value is, the less penetrations will be visible after one timestep where the velocity solver did not converge entirely. Large values will degrade significantly the performance of the simulation.

    To increase realism of the simulation it is recommended, more efficient, and more effecive, to increase the number of velocity iterations instead of this number of position iterations.

    Parameters

    • niter: number

      The new maximum number of position iterations.

    Returns any

maxVelocityIterations

  • get maxVelocityIterations(): number
  • set maxVelocityIterations(niter: number): any
  • The maximum velocity iterations the velocity-based force constraint solver can make.

    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.

    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.

    Returns number

  • Sets the maximum number of velocity iterations (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 maximum number of velocity iterations.

    Returns any

timestep

  • get timestep(): number
  • set timestep(dt: number): any
  • The current 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.

    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.

    Returns number

  • 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

    Returns any

Methods

castRay

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderToi | null

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderToi | null

castRayAndGetNormal

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderIntersection | null

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    Returns RayColliderIntersection | null

castShape

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

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to cast, in order to only test on colliders with collision groups compatible with this group.

    Returns ShapeColliderTOI | null

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

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to cast, in order to only test on colliders with collision groups compatible with this group.

    Returns ShapeColliderTOI | null

collidersWithAabbIntersectingAabb

  • collidersWithAabbIntersectingAabb(aabbCenter: Vector, aabbHalfExtents: Vector, callback: (handle: ColliderHandle) => boolean): void
  • collidersWithAabbIntersectingAabb(aabbCenter: Vector, aabbHalfExtents: Vector, callback: (handle: ColliderHandle) => boolean): 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: ColliderHandle) => boolean

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

    Returns 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: ColliderHandle) => boolean

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

    Returns void

contactPair

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

    Parameters

    • collider1: ColliderHandle

      The first collider involved in the contact.

    • collider2: ColliderHandle

      The second collider involved in the contact.

    • f: (manifold: TempContactManifold, flipped: boolean) => 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.

    Returns void

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

    Parameters

    • collider1: ColliderHandle

      The first collider involved in the contact.

    • collider2: ColliderHandle

      The second collider involved in the contact.

    • f: (manifold: TempContactManifold, flipped: boolean) => 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.

    Returns void

contactsWith

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

    Parameters

    Returns void

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

    Parameters

    Returns void

createCollider

  • Creates a new collider.

    Parameters

    • desc: ColliderDesc

      The description of the collider.

    • Optional parentHandle: RigidBodyHandle

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

    Returns Collider

  • Creates a new collider.

    Parameters

    • desc: ColliderDesc

      The description of the collider.

    • Optional parentHandle: RigidBodyHandle

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

    Returns Collider

createJoint

  • Creates a new joint from the given joint descriptior.

    Parameters

    • params: JointParams
    • parent1: RigidBody

      The first rigid-body attached to this joint.

    • parent2: RigidBody

      The second rigid-body attached to this joint.

    Returns Joint

  • Creates a new joint from the given joint descriptior.

    Parameters

    • params: JointParams
    • parent1: RigidBody

      The first rigid-body attached to this joint.

    • parent2: RigidBody

      The second rigid-body attached to this joint.

    Returns Joint

createRigidBody

  • Creates a new rigid-body from the given rigd-body descriptior.

    Parameters

    • body: RigidBodyDesc

      The description of the rigid-body to create.

    Returns RigidBody

  • Creates a new rigid-body from the given rigd-body descriptior.

    Parameters

    • body: RigidBodyDesc

      The description of the rigid-body to create.

    Returns RigidBody

forEachActiveRigidBody

  • forEachActiveRigidBody(f: (body: RigidBody) => void): void
  • forEachActiveRigidBody(f: (body: RigidBody) => void): 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: RigidBody) => void

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

    Returns 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: RigidBody) => void

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

    Returns void

forEachActiveRigidBodyHandle

  • Applies the given closure to the integer handle of 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

    Returns void

  • Applies the given closure to the integer handle of 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

    Returns void

forEachCollider

  • forEachCollider(f: (collider: Collider) => void): void
  • forEachCollider(f: (collider: Collider) => void): void
  • Applies the given closure to each collider managed by this physics world.

    Parameters

    Returns void

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

    Parameters

    Returns void

forEachColliderHandle

  • Applies the given closure to the integer handle of each collider managed by this physics world.

    Parameters

    Returns void

  • Applies the given closure to the integer handle of each collider managed by this physics world.

    Parameters

    Returns void

forEachRigidBody

  • forEachRigidBody(f: (body: RigidBody) => void): void
  • forEachRigidBody(f: (body: RigidBody) => void): void
  • Applies the given closure to each rigid-body managed by this physics world.

    Parameters

    Returns void

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

    Parameters

    Returns void

forEachRigidBodyHandle

  • Applies the given closure to the integer handle of each rigid-body managed by this physics world.

    Parameters

    Returns void

  • Applies the given closure to the integer handle of each rigid-body managed by this physics world.

    Parameters

    Returns void

free

  • free(): void
  • 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

  • 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

getCollider

  • Retrieves a collider from its handle.

    Parameters

    • handle: ColliderHandle

      The integer handle of the collider to retrieve.

    Returns Collider

  • Retrieves a collider from its handle.

    Parameters

    • handle: ColliderHandle

      The integer handle of the collider to retrieve.

    Returns Collider

getJoint

  • Retrieves a joint from its handle.

    Parameters

    • handle: JointHandle

      The integer handle of the rigid-body to retrieve.

    Returns Joint

  • Retrieves a joint from its handle.

    Parameters

    • handle: JointHandle

      The integer handle of the rigid-body to retrieve.

    Returns Joint

getRigidBody

  • Retrieves a rigid-body from its handle.

    Parameters

    • handle: RigidBodyHandle

      The integer handle of the rigid-body to retrieve.

    Returns RigidBody

  • Retrieves a rigid-body from its handle.

    Parameters

    • handle: RigidBodyHandle

      The integer handle of the rigid-body to retrieve.

    Returns RigidBody

intersectionPair

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

    Parameters

    • collider1: ColliderHandle

      − The first collider involved in the intersection.

    • collider2: ColliderHandle

      − The second collider involved in the intersection.

    Returns boolean

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

    Parameters

    • collider1: ColliderHandle

      − The first collider involved in the intersection.

    • collider2: ColliderHandle

      − The second collider involved in the intersection.

    Returns boolean

intersectionWithShape

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

    • groups: InteractionGroups

      The bit groups and filter associated to the ray, in order to only hit the colliders with collision groups compatible with the ray's group.

    Returns ColliderHandle | null

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

    • groups: InteractionGroups

      The bit groups and filter associated to the ray, in order to only hit the colliders with collision groups compatible with the ray's group.

    Returns ColliderHandle | null

intersectionsWith

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

    Parameters

    Returns void

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

    Parameters

    Returns void

intersectionsWithPoint

  • intersectionsWithPoint(point: Vector, groups: InteractionGroups, callback: (ColliderHandle: any) => boolean): void
  • intersectionsWithPoint(point: Vector, groups: InteractionGroups, callback: (ColliderHandle: any) => boolean): void
  • Find all the colliders containing the given point.

    Parameters

    • point: Vector

      The point used for the containment test.

    • groups: InteractionGroups

      The bit groups and filter associated to the point to test, in order to only test on colliders with collision groups compatible with the ray's group.

    • callback: (ColliderHandle: any) => boolean

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

        • (ColliderHandle: any): boolean
        • Parameters

          • ColliderHandle: any

          Returns boolean

    Returns void

  • Find all the colliders containing the given point.

    Parameters

    • point: Vector

      The point used for the containment test.

    • groups: InteractionGroups

      The bit groups and filter associated to the point to test, in order to only test on colliders with collision groups compatible with the ray's group.

    • callback: (ColliderHandle: any) => boolean

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

        • (ColliderHandle: any): boolean
        • Parameters

          • ColliderHandle: any

          Returns boolean

    Returns void

intersectionsWithRay

  • intersectionsWithRay(ray: Ray, maxToi: number, solid: boolean, groups: InteractionGroups, callback: (RayColliderIntersection: any) => boolean): void
  • intersectionsWithRay(ray: Ray, maxToi: number, solid: boolean, groups: InteractionGroups, callback: (RayColliderIntersection: any) => boolean): 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.

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    • callback: (RayColliderIntersection: any) => 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.

        • (RayColliderIntersection: any): boolean
        • Parameters

          • RayColliderIntersection: any

          Returns boolean

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

    • groups: InteractionGroups

      Used to filter the colliders that can or cannot be hit by the ray.

    • callback: (RayColliderIntersection: any) => 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.

        • (RayColliderIntersection: any): boolean
        • Parameters

          • RayColliderIntersection: any

          Returns boolean

    Returns void

intersectionsWithShape

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to test, in order to only test on colliders with collision groups compatible with this group.

    • callback: (handle: ColliderHandle) => boolean

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

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

    • groups: InteractionGroups

      The bit groups and filter associated to the shape to test, in order to only test on colliders with collision groups compatible with this group.

    • callback: (handle: ColliderHandle) => boolean

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

    Returns void

projectPoint

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

    • groups: InteractionGroups

      The bit groups and filter associated to the point to project, in order to only project on colliders with collision groups compatible with the ray's group.

    Returns PointColliderProjection | null

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

    • groups: InteractionGroups

      The bit groups and filter associated to the point to project, in order to only project on colliders with collision groups compatible with the ray's group.

    Returns PointColliderProjection | null

removeCollider

  • removeCollider(collider: Collider, wakeUp: boolean): void
  • removeCollider(collider: Collider, wakeUp: boolean): 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

  • 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

removeJoint

  • removeJoint(joint: Joint, wakeUp: boolean): void
  • removeJoint(joint: Joint, wakeUp: boolean): void
  • Removes the given joint from this physics world.

    Parameters

    • joint: Joint

      The joint to remove.

    • wakeUp: boolean

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

    Returns void

  • Removes the given joint from this physics world.

    Parameters

    • joint: Joint

      The joint to remove.

    • wakeUp: boolean

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

    Returns void

removeRigidBody

  • 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

    Returns 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

    Returns void

step

  • Advance the simulation by one time step.

    All events generated by the physics engine are ignored.

    Parameters

    Returns void

  • Advance the simulation by one time step.

    All events generated by the physics engine are ignored.

    Parameters

    Returns void

takeSnapshot

  • takeSnapshot(): Uint8Array
  • 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

  • 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

Static fromRaw

  • fromRaw(raw: RawDeserializedWorld): World
  • fromRaw(raw: RawDeserializedWorld): World
  • Parameters

    • raw: RawDeserializedWorld

    Returns World

  • Parameters

    • raw: RawDeserializedWorld

    Returns World

Static restoreSnapshot

  • restoreSnapshot(data: Uint8Array): World
  • restoreSnapshot(data: Uint8Array): 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

  • 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

Generated using TypeDoc