ScriptController

new ScriptController(model, object3D, scripts)

Controller of object3D script component

Parameters:
NameTypeDescription
modelScriptModel

model of this controller

object3Dobject

object3D parent of the script component TODO; cyclic reference why controller need to know their object3D ?

scriptsMap.<string, object>

instances of scripts

Members

scripts :Map.<string, object>

instances of scripts

Type:
  • Map.<string, object>

Methods

execute(event, params)

Execute all scripts for a particular event

Parameters:
NameTypeDescription
eventstring

event trigger (event should be a method of the script instances)

paramsArray

parameters pass to scripts

executeScript(script, event, params) → {*}

Execute a script for a particular event

Parameters:
NameTypeDescription
scriptobject

instance of script (class)

eventstring

event trigger (event should be a method of the script instance)

paramsArray

parameters to pass to the script

Returns:
  • value return by the script (null if no event associated at ths script)
Type: 
*

setVariables(variables)

Modify variables of the model + overwrite variables in scripts

Parameters:
NameTypeDescription
variablesobject

new variables of this script controller