Repository

PhysicsEngine

Extends:

Component → PhysicsEngine

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

G: *

public

bodies: *[]

public
public
public
public

joints: *[]

public

ke: *

public
Private Members
private

_time: *

Method Summary

Public Methods
public

addBody(position: Vector3, mass: Number, object: Mesh): Body

addBody

public

addElectrostaticsJoint(body1: Mesh, body2: Mesh, charge1: Number, charge2: Number): Body

addElectrostaticsJoint

public

addFixedJoint(body: Mesh, position: Vector3): Body

addFixedJoint

public

addGravityJoint(body1: Mesh, body2: Mesh): Body

addGravityJoint

public

addSpringJoint(body1: Mesh, body2: Mesh, distance: Number, k: Number, damping: Number): Body

addSpringJoint

public

addStickJoint(body1: Mesh, body2: Mesh, distance: Number): Body

addStickJoint

public

addStringJoint(body1: Mesh, body2: Mesh, distance: Number): Body

addStringJoint

public

setGlobalGravity

public

setGlobalWind

public

Set the number of iteration made by the physic engine

public

Initialization method

public

Inherited Summary

From class Component
public
public
public

events: *

public

id: *

public

name: *

private

_nexts: *[]

private
public
public

chain(component: Component)

Adds a component to this chained component array

public

Returns the array of attached children components

public

off()

Deactivate the component

public

on()

Activate the component A call to this method calls the setup method if it has not been run yet

public

Run code after the update of all components is run This empty method is usually overriden to perform post-update actions for the component It is called periodically by an internal Mobilizing mechanism

public

preLoad the component This empty method is usually overriden to perform preLoad actions for the component.

public

Run code before the update of all components is run This empty method is usually overriden to perform pre-update actions for the component It is called once per component by an internal Mobilizing mechanism

public

prepare the component This empty method is usually overriden to perform preparation actions for the component, from external process as a server.

public

Set's up the component This empty method is usually overriden to perform setup actions for the component This is where all the initialization (such as adding event listeners)should be done It is called automatically by an internal Mobilizing mechanism and should thus not be called directly

public

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Public Constructors

public constructor(params: Object) source

Override:

Component#constructor

Params:

NameTypeAttributeDescription
paramsObject

Parameters object, given by the constructor.

params.iterationsNumber

iterations of the physic engine when constrains are calculated

Public Members

public G: * source

public bodies: *[] source

public globalgravity: * source

public globalwind: * source

public iterations: * source

public joints: *[] source

public ke: * source

public relaxationCoeff: number source

Private Members

private _time: * source

Public Methods

public addBody(position: Vector3, mass: Number, object: Mesh): Body source

addBody

Params:

NameTypeAttributeDescription
positionVector3
massNumber
objectMesh

the Mesh to attach this physics body to

Return:

Body

the added physic body

public addElectrostaticsJoint(body1: Mesh, body2: Mesh, charge1: Number, charge2: Number): Body source

addElectrostaticsJoint

Params:

NameTypeAttributeDescription
body1Mesh
body2Mesh
charge1Number
charge2Number

Return:

Body

the added joint body

public addFixedJoint(body: Mesh, position: Vector3): Body source

addFixedJoint

Params:

NameTypeAttributeDescription
bodyMesh
positionVector3

Return:

Body

the added joint body

public addGravityJoint(body1: Mesh, body2: Mesh): Body source

addGravityJoint

Params:

NameTypeAttributeDescription
body1Mesh
body2Mesh

Return:

Body

the added joint body

public addSpringJoint(body1: Mesh, body2: Mesh, distance: Number, k: Number, damping: Number): Body source

addSpringJoint

Params:

NameTypeAttributeDescription
body1Mesh
body2Mesh
distanceNumber
kNumber
dampingNumber

Return:

Body

the added joint body

public addStickJoint(body1: Mesh, body2: Mesh, distance: Number): Body source

addStickJoint

Params:

NameTypeAttributeDescription
body1Mesh
body2Mesh
distanceNumber

Return:

Body

the added joint body

public addStringJoint(body1: Mesh, body2: Mesh, distance: Number): Body source

addStringJoint

Params:

NameTypeAttributeDescription
body1Mesh
body2Mesh
distanceNumber

Return:

Body

the added joint body

public setGlobalGravity(vector: Vector3) source

setGlobalGravity

Params:

NameTypeAttributeDescription
vectorVector3

public setGlobalWind(vector: Vector3) source

setGlobalWind

Params:

NameTypeAttributeDescription
vectorVector3

public setIterations(val: Number) source

Set the number of iteration made by the physic engine

Params:

NameTypeAttributeDescription
valNumber

public setup() source

Initialization method

Override:

Component#setup

public update() source

Update the component This empty method is usually overriden to perform update actions for the component It is called periodically by an internal Mobilizing mechanism

Override:

Component#update