Skip to main content

Class: Physics

Defined in: src/physics/Physics.ts:11

Integrates the RAPIER physics engine into the XRCore lifecycle. It sets up the physics in a blended world that combines virtual and physical objects, steps the simulation forward in sync with the application's framerate, and manages the lifecycle of physics-related objects.

Constructors

Constructor

new Physics(): Physics

Returns

Physics

Properties

blendedWorld

blendedWorld: World

Defined in: src/physics/Physics.ts:16


eventQueue

eventQueue: EventQueue

Defined in: src/physics/Physics.ts:17


fps

fps: number = 0

Defined in: src/physics/Physics.ts:15


initialized

initialized: boolean = false

Defined in: src/physics/Physics.ts:12


options?

optional options: PhysicsOptions

Defined in: src/physics/Physics.ts:13


RAPIER

RAPIER: RAPIERCompat

Defined in: src/physics/Physics.ts:14

Accessors

timestep

Get Signature

get timestep(): number

Defined in: src/physics/Physics.ts:19

Returns

number

Methods

dispose()

dispose(): void

Defined in: src/physics/Physics.ts:56

Frees the memory allocated by the RAPIER physics blendedWorld and event queue. This is crucial for preventing memory leaks when the XR session ends.

Returns

void


init()

init(__namedParameters): Promise<void>

Defined in: src/physics/Physics.ts:27

Asynchronously initializes the RAPIER physics engine and creates the blendedWorld. This is called in Core before the physics simulation starts.

Parameters

__namedParameters
physicsOptions

PhysicsOptions

Returns

Promise<void>


physicsStep()

physicsStep(): void

Defined in: src/physics/Physics.ts:45

Advances the physics simulation by one step.

Returns

void