ObjectComponent3D Class
Handles the 3D object instanciation for wanaplan.
Constructor
ObjectComponent3D
-
core
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Properties
Methods
addObjectToScene
-
object3d
-
structureObject
-
floorStructure
-
[callback]
-
[silent=false]
Prepares the 3D object to be added to the scene, according to its ObjectStructure
Parameters:
-
object3d
BABYLON.MeshThe mesh of the object.
-
structureObject
ObjectStructureThe object structure to be added.
-
floorStructure
FloorStructureThe floor where the object will be appended.
-
[callback]
Function optionalThe function called after the object is built.
-
[silent=false]
Boolean optionalIf true, no event will be thrown at the object creation.
applyShadow
-
UNKNOWN
Applies shadows to the object and all of its children
Parameters:
-
UNKNOWN
Object3d
buildObject
-
objectStructure
-
params
-
[floorStructure]
-
[callback]
-
[silent=false]
Builds a new object, given the object structure and the object params. As this may require to load scripts, the function is asynchronous. Appends the object to the floor when it is ready.
Parameters:
-
objectStructure
ObjectStructureThe object structure to be instanciated.
-
params
ObjectParams of the object to be instanciated such as defined in the relevant programmable.
-
[materials]
BABYLON.Material optionalContains labeled materials. If the materials are already defined in
objectStructure.programmableInstance
, this will have no effect.
-
-
[floorStructure]
FloorStructure optionalThe floor where the object will be appended, default is the current floor.
-
[callback]
Function optionalThe function called after the object is built.
-
[silent=false]
Boolean optionalIf true, no event will be thrown at the object creation.
compute
()
private
destroy
()
disable
()
enable
()
getFloor
-
[structure]
Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
The floor mesh in 3D.
getValue
-
targetValue
-
defaultValue
Gets a value from the parameter. If parameter is undefined then returns the default value.
Parameters:
Returns:
value of targetValue if not undefined, else defaultValue.
getVector3
-
pVector
Gets a type Vector3 object from a litteral JavaScript object with 3 components x, y, z.
Parameters:
-
pVector
ObjectA litteral object with 3 components x, y, z.
Returns:
An instance of BABYLON.Vector3 with the chosen x, y, z. If pVector is already a BABYLON.Vector3, it is returned without any change.
initialize
()
onAddGroup
-
event
Adds a group of 3D objects to the current floor.
Triggered on event wnp.engine3D.addGroup
.
Parameters:
-
event
EventThe JS event.
onAddObject
-
event
Creates a new 3D object on the current floor (by default at the avatar position).
Triggered on event wnp.engine3D.addObject
or wnp.engine3D.addProgrammable
.
Parameters:
-
event
EventThe JS event.
Returns:
The created object structure.
onContextChanged
-
context
Parameters:
-
context
StringThe new context
onFloorReady
-
event
When a floor is ready, creates the objects it contains.
Triggered on event wnp.engine3D.floorReady
.
Parameters:
-
event
EventThe JS event.
onRemoveObject
-
event
Removes a 3D object from the scene.
Triggered on event wnp.engine3D.object.remove
.
Parameters:
-
event
EventThe JS event.
refreshObject
-
meshObject
-
[callback]
Rebuilds the object, assuming the structure object has changed (not necessarily the case). The object reference will be kept. This function is asynchronous.
Parameters:
-
meshObject
BABYLON.MeshThe mesh object, as defined in wanaplan. It should declare a reference to the
objectStructure
( meshObject.structure ). -
[callback]
Function optionalThe function called once the object is built. Takes the new mesh as its only parameter.
startListening
()
stopListening
()
update
-
deltaTime
Parameters:
-
deltaTime
NumberThe time interval.
Properties
keyboardManager
wnp.KeyboardManager
structure
wnp.Structure
Events
wnp.engine3D.object.create
Fired when an object is created.
Event Payload:
-
object
BABYLON.MeshThe created mesh.
-
objectStructure
ObjectStructureThe involved object structure.
wnp.engine3D.object.dispose
Fired when a mesh is disposed of.
Event Payload:
-
object
BABYLON.MeshThe concerned mesh.
wnp.engine3D.object.refresh
Fired when an object is rebuilt.
Event Payload:
-
object
BABYLON.MeshThe refreshed mesh.