• Public
  • Public/Protected
  • All

Class PhysicsEngine

Class used to control physics engine




  • PhysicsEngine





  • Creates a new Physics Engine


    • gravity: Nullable<Vector3>

      defines the gravity vector used by the simulation

    • Optional _physicsPlugin: IPhysicsEnginePlugin

      defines the plugin to use (CannonJS by default)

    Returns PhysicsEngine


gravitySearch playground for gravity

gravity: Vector3

Gets the gravity vector used by the simulation

Static EpsilonSearch playground for Epsilon

Epsilon: number

Global value used to control the smallest number supported by the simulation


_stepSearch playground for _step

  • _step(delta: number): void
  • Called by the scene. No need to call it.


    • delta: number

      defines the timespan between frames

    Returns void

addImpostorSearch playground for addImpostor

  • Adding a new impostor for the impostor tracking. This will be done by the impostor itself.


    Returns void

addJointSearch playground for addJoint

  • Add a joint to the physics engine


    • mainImpostor: PhysicsImpostor

      defines the main impostor to which the joint is added.

    • connectedImpostor: PhysicsImpostor

      defines the impostor that is connected to the main impostor using this joint

    • joint: PhysicsJoint

      defines the joint that will connect both impostors.

    Returns void

disposeSearch playground for dispose

  • dispose(): void
  • Release all resources

    Returns void

getImpostorForPhysicsObjectSearch playground for getImpostorForPhysicsObject

getImpostorWithPhysicsBodySearch playground for getImpostorWithPhysicsBody

getImpostorsSearch playground for getImpostors

getPhysicsPluginSearch playground for getPhysicsPlugin

  • getPhysicsPlugin(): IPhysicsEnginePlugin
  • Gets the current plugin used to run the simulation

    Returns IPhysicsEnginePlugin

    current plugin

getPhysicsPluginNameSearch playground for getPhysicsPluginName

  • getPhysicsPluginName(): string
  • Gets the name of the current physics plugin

    Returns string

    the name of the plugin

getSubTimeStepSearch playground for getSubTimeStep

  • getSubTimeStep(): number
  • Get the sub time step of the physics engine.

    Returns number

    the current sub time step

getTimeStepSearch playground for getTimeStep

  • getTimeStep(): number
  • Get the time step of the physics engine.

    Returns number

    the current time step

raycastSearch playground for raycast

removeImpostorSearch playground for removeImpostor

  • Remove an impostor from the engine. This impostor and its mesh will not longer be updated by the physics engine.


    Returns void

removeJointSearch playground for removeJoint

  • Removes a joint from the simulation


    • mainImpostor: PhysicsImpostor

      defines the impostor used with the joint

    • connectedImpostor: PhysicsImpostor

      defines the other impostor connected to the main one by the joint

    • joint: PhysicsJoint

      defines the joint to remove

    Returns void

setGravitySearch playground for setGravity

  • setGravity(gravity: Vector3): void
  • Sets the gravity vector used by the simulation


    • gravity: Vector3

      defines the gravity vector to use

    Returns void

setSubTimeStepSearch playground for setSubTimeStep

  • setSubTimeStep(subTimeStep?: number): void
  • Set the sub time step of the physics engine. Default is 0 meaning there is no sub steps To increase physics resolution precision, set a small value (like 1 ms)


    • Optional subTimeStep: number

      defines the new sub timestep used for physics resolution.

    Returns void

setTimeStepSearch playground for setTimeStep

  • setTimeStep(newTimeStep?: number): void
  • Set the time step of the physics engine. Default is 1/60. To slow it down, enter 1/600 for example. To speed it up, 1/30


    • Optional newTimeStep: number

      defines the new timestep to apply to this world.

    Returns void

Static DefaultPluginFactorySearch playground for DefaultPluginFactory

  • DefaultPluginFactory(): IPhysicsEnginePlugin
  • Factory used to create the default physics plugin.

    Returns IPhysicsEnginePlugin

    The default physics plugin


  • Constructor
  • Property
  • Method
  • Property
  • Method
  • Inherited property
  • Inherited method
  • Static property
  • Static method