Object3D

new Object3D(json)

Base class extended THREE.Object3D to compose 3D scene of ud-viz game

Parameters:
NameTypeDescription
jsonobject

json to configure the object3D

Properties
NameTypeAttributesDefaultDescription
uuidstring<optional>

uuid

parentUUIDstring<optional>

uuid of this parent object3D

userDataobject<optional>

userData

namestring<optional>
""

name

staticboolean<optional>
false

static

outdatedboolean<optional>
false

outdated

visbleboolean<optional>
true

visible

gameContextUpdateboolean<optional>
true

should be update from the game context

forceToJSONComponentArray.<string><optional>
[]

force certain component to be export in json

componentsObject.<string, object><optional>
{}

components Component

matrixArray<optional>

matrix

childrenArray.<object><optional>

json of children of object3D

Members

components :Object.<string, object>

Type:
  • Object.<string, object>

forceToJSONComponent :Array.<string>

force certain component to be export in json

Type:
  • Array.<string>

gameContextUpdate :boolean

true if object3D should consider game context update

Type:
  • boolean

isGameObject3D :boolean

tag to make difference between this and THREE.Object3D

Type:
  • boolean

matrixAutoUpdate :boolean

Type:
  • boolean

name :string

name of object3D

Type:
  • string

outdated :boolean

true if object3D model has changed

Type:
  • boolean

parentUUID :string|null

uuid of the parent object3D

Type:
  • string | null

static :boolean

true if the object3D is not going to move in space

Type:
  • boolean

userData :object

user data

Type:
  • object

uuid :string

uuid of object3D

Type:
  • string

visible :boolean

Type:
  • boolean

Methods

clone() → {Object3D}

Returns:
  • clone of object3D
Type: 
Object3D

filter(condition) → {Object3D}

Parameters:
NameTypeDescription
conditionObject3DCondition

condition to test

Returns:
  • return an array of objects3D in hierarchy matching condition
Type: 
Object3D

getComponent(type) → {object}

Parameters:
NameTypeDescription
typestring

type of the component

Returns:
  • component of type
Type: 
object

getComponents() → {Object.<string, object>}

Returns:
  • components of object3D @see Component
Type: 
Object.<string, object>

getFirst(condition) → {Object3D}

Parameters:
NameTypeDescription
conditionObject3DCondition

condition to test

Returns:
  • return first object3D in hierarchy matching condition
Type: 
Object3D

hasGameContextUpdate() → {boolean}

Returns:
  • true if this has game context update
Type: 
boolean

isOutdated() → {boolean}

Returns:
  • true if object3D is outdated (model has changed)
Type: 
boolean

isStatic() → {boolean}

Returns:
  • true if object3D is static
Type: 
boolean

setOutdated(value)

Parameters:
NameTypeDescription
valueboolean

true if object3D is outdated (model has changed)

toJSON(fullopt, withMetadataopt, withChildrenopt) → {object}

Parameters:
NameTypeAttributesDefaultDescription
fullboolean<optional>
true

component with controllers should be added to the result

withMetadataboolean<optional>
false

add metadata to the result

withChildrenboolean<optional>
true

add children to the result

Returns:
  • object of the object3D if withMetatdata = false, otherwise the object is store in result.object and metadata in result.metadata
Type: 
object

traverse(cb) → {boolean}

Apply a callback to object3D and its children recursively like THREE.Object3D This is not exactly the same one since there is the possibility to stop the traverse and the possibility to remove an object3D while parent is traversed TODO: object should not be remove though since its cause of bug !!! (maybe test with a descendant for loop (i--))

Parameters:
NameTypeDescription
cbTraverseCallback

callback to apply to object3D and its children recursively

Returns:
  • true when traverse should be stop
Type: 
boolean

updateComponentFromJSON(componentsJSON)

Parameters:
NameTypeDescription
componentsJSONObject.<string, object>

json components to update from

updateMatrixFromJSON(jsonMatrix) → {void}

Parameters:
NameTypeDescription
jsonMatrixArray

array of the matrix

Returns:
Type: 
void

updatefromJSON(json)

Parameters:
NameTypeDescription
jsonobject

json to update from

Properties
NameTypeAttributesDefaultDescription
uuidstring

uuid

componentsObject.<string, object><optional>
{}

components Component

matrixArray<optional>

matrix

namestring

name

staticboolean

static

outdatedboolean

outdated

childrenArray.<object>

json of children of object3D

(static) DefaultForward() → {THREE.Vector3}

Returns:
  • Default forward of Object3D
Type: 
THREE.Vector3

(static) DefaultUp() → {THREE.Vector3}

Returns:
  • Default up vector of Object3D
Type: 
THREE.Vector3

(static) computeBackward(object3D) → {THREE.Vector3}

Parameters:
NameTypeDescription
object3DObject3D

object3D to compute backward vector

Returns:
  • backward vector of object3D
Type: 
THREE.Vector3

(static) computeDown(object3D) → {THREE.Vector3}

Parameters:
NameTypeDescription
object3DObject3D

object3D to compute down vector

Returns:
  • down vector of object3D
Type: 
THREE.Vector3

(static) computeForward(object3D) → {THREE.Vector3}

Parameters:
NameTypeDescription
object3DObject3D

object3D to compute forward vector

Returns:
  • forward vector of object3D
Type: 
THREE.Vector3

(static) computeUp(object3D) → {THREE.Vector3}

Parameters:
NameTypeDescription
object3DObject3D

object3D to compute up vector

Returns:
  • up vector of object3D
Type: 
THREE.Vector3

(static) deepCopy(object3D) → {Object3D}

Return a deep copy of object3D (uuids and name are regenerated)

Parameters:
NameTypeDescription
object3DObject3D

object3D to deep copy

Returns:
  • deep copy of object3D
Type: 
Object3D

(static) fetchFirstGameObject3D(object) → {Object3D}

Parse parent object till finding a gameobject

Parameters:
NameTypeDescription
objectTHREE.Object3D

object to fetch into

Returns:
  • first gameobject found in hierarchy
Type: 
Object3D

(static) parseJSON(json) → {object}

If json has metadata update object of object3D if not nothing is done

Parameters:
NameTypeDescription
jsonobject

json of object3D

Returns:
  • json object of object3D
Type: 
object