Context

new Context(frame3D, assetManager, inputManager, externalGameScriptClass, options)

Parameters:
NameTypeDescription
frame3Dframe3d.Base | frame3d.Planar

frame3D view of the game

assetManagerAssetManager

asset manager AssetManager

inputManagerInputManager

input manager InputManager

externalGameScriptClassObject.<string, ScriptBase>

custom external script ScriptBase

optionsobject

options of context

Properties
NameTypeDescription
userDataobject

user data of context

socketIOWrapperobject

socket io wrapper if multi

interpolatorobject

interpolator

Members

assetManager :AssetManager

asset manager

currentGameObject3D :Object3D

current root gameobject3D (child of this.object3D)

Type:
  • Object3D

currentUUID :Object.<string, boolean>

register uuid of object3D in context to identify new one incoming

Type:
  • Object.<string, boolean>

dt :number

delta time of context

Type:
  • number

externalGameScriptClass :Object.<string, ScriptBase>

custom ScriptBase that can be used by object3D

Type:

frame3D :frame3d.Base|frame3d.Planar

frame3D view of game

Type:
  • frame3d.Base | frame3d.Planar

inputManager :InputManager

input manager

interpolator :object|null

interpolator

Type:
  • object | null

object3D :THREE.Object3D

root object3D

Type:
  • THREE.Object3D

socketIOWrapper :undefined|null

socket io wrapper

Type:
  • undefined | null

userData :object

user data context

Type:
  • object

(static) EVENT

Event triggered by context to ScriptBase

Methods

createInstanceOf(id, object3D, modelVariables) → {ScriptBase}

Create a class instance of external game script class for an object3D given an id

Parameters:
NameTypeDescription
idstring

id of the class

object3DObject3D

object3D that is going to use this instance

modelVariablesobject

custom variables associated to this instance

Returns:
  • instance of the class bind with object3D and modelVariables
Type: 
ScriptBase

findExternalScriptWithID(id, object3Dopt) → {ScriptBase|null}

Parameters:
NameTypeAttributesDefaultDescription
idstring

id of script

object3DObject3D<optional>
this.object3D

object3D to traverse to find the external script (default is the root game object3D)

Returns:
  • first external script with id or null if none are found
Type: 
ScriptBase | null

initComponentControllers(go)

Parameters:
NameTypeDescription
goObject3D

gameobject3D to init controllers

initFrame3D(frame3D)

Parameters:
NameTypeDescription
frame3Dframe3d.Planar | frame3d.Base

intialize frame3D of context

reset(newFrame3D)

Reset context state and initialize the new frame3D

Parameters:
NameTypeDescription
newFrame3Dframe3d.Planar | frame3d.Base

new frame3D to reset with

sendCommandsToGameContext(cmds)

This method need to be implemented by user

Parameters:
NameTypeDescription
cmdsArray.<Command>

commands to send to game context

step(dt, states)

Step context

Parameters:
NameTypeDescription
dtnumber

new delta time context

statesArray.<State>

new states to update context current gameobject3D