PhysicsEngine

Engine

Description

class PhysicsEngine

Constructor

new PhysicsEngine(gravity, _physicsPlugin)

Parameters

Name Type Description
gravity Nullable<Vector3>
optional _physicsPlugin IPhysicsEnginePlugin

Members

gravity : Vector3

static Epsilon : number

Methods

setGravity(gravity) void

Parameters

Name Type Description
gravity Vector3

setTimeStep(newTimeStep) 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

Parameters

Name Type Description
optional newTimeStep number

getTimeStep() number

Get the time step of the physics engine.

dispose() void

getPhysicsPluginName() string

addImpostor(impostor) void

Adding a new impostor for the impostor tracking.

This will be done by the impostor itself.

Parameters

Name Type Description
impostor PhysicsImpostor

removeImpostor(impostor) void

Remove an impostor from the engine.

This impostor and its mesh will not longer be updated by the physics engine.

Parameters

Name Type Description
impostor PhysicsImpostor

addJoint(mainImpostor, connectedImpostor, joint) void

Add a joint to the physics engine

Parameters

Name Type Description
mainImpostor PhysicsImpostor
connectedImpostor PhysicsImpostor
joint PhysicsJoint

removeJoint(mainImpostor, connectedImpostor, joint) void

Parameters

Name Type Description
mainImpostor PhysicsImpostor
connectedImpostor PhysicsImpostor
joint PhysicsJoint

getPhysicsPlugin() IPhysicsEnginePlugin

getImpostors() Array<PhysicsImpostor>

getImpostorForPhysicsObject(object) Nullable<PhysicsImpostor>

Parameters

Name Type Description
object IPhysicsEnabledObject

getImpostorWithPhysicsBody(body) Nullable<PhysicsImpostor>

Parameters

Name Type Description
body any