ObjectComponent3D
Summary
Handles the 3D object instanciation for wanaplan.
Constructor
ObjectComponent3D
Syntax
ObjectComponent3D
-
core
Summary
Parameters:
-
core
CoreThe main engine.
Item Index
Methods
Properties
Methods
addObjectToScene
Syntax
addObjectToScene
-
object3d
-
structureObject
-
floorStructure
-
[callback]
-
[silent=false]
Summary
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
Syntax
applyShadow
-
UNKNOWN
Summary
Applies shadows to the object and all of its children
Parameters:
-
UNKNOWN
Object3d
buildObject
Syntax
buildObject
-
objectStructure
-
params
-
[floorStructure]
-
[callback]
-
[silent=false]
Summary
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
Syntax
compute
()
private
Summary
Recompute of the component.destroy
Syntax
destroy
()
Summary
Destructor.disable
Syntax
disable
()
Summary
Disables the componentenable
Syntax
enable
()
Summary
Enables the componentgetFloor
Syntax
getFloor
-
[structure]
Summary
Gets the 3D mesh of the floor structure in parameter (by default current floor).Parameters:
-
[structure]
FloorStructure optionalThe floor structure.
Returns:
The floor mesh in 3D.
getValue
Syntax
Summary
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
Syntax
getVector3
-
pVector
Summary
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
Syntax
initialize
()
Summary
Method called when Wanaplan is initialized. You don't need to call this method manually.onAddGroup
Syntax
onAddGroup
-
event
Summary
Adds a group of 3D objects to the current floor.
Triggered on event wnp.engine3D.addGroup
.
Parameters:
-
event
EventThe JS event.
onAddObject
Syntax
Summary
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
Syntax
onContextChanged
-
context
Summary
Method called when the context is switched (2D -> 3D or 3D -> 2D)Parameters:
-
context
StringThe new context
onFloorReady
Syntax
onFloorReady
-
event
Summary
When a floor is ready, creates the objects it contains.
Triggered on event wnp.engine3D.floorReady
.
Parameters:
-
event
EventThe JS event.
onRemoveObject
Syntax
onRemoveObject
-
event
Summary
Removes a 3D object from the scene.
Triggered on event wnp.engine3D.object.remove
.
Parameters:
-
event
EventThe JS event.
refreshObject
Syntax
refreshObject
-
meshObject
-
[callback]
Summary
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
Syntax
startListening
()
Summary
Calls all the event listeners.stopListening
Syntax
stopListening
()
Summary
Removes all the event listeners.update
Syntax
update
-
deltaTime
Summary
Updates the dynamic part of the component.Parameters:
-
deltaTime
NumberThe time interval.
Properties
keyboardManager
Syntax
keyboardManager
wnp.KeyboardManager
Summary
Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).structure
Syntax
structure
wnp.Structure
Summary
Instance of the structure (shortcut to wanaplan.structure).Events
wnp.engine3D.object.create
Syntax
wnp.engine3D.object.create
Summary
Fired when an object is created.
Event Payload:
-
object
BABYLON.MeshThe created mesh.
-
objectStructure
ObjectStructureThe involved object structure.
wnp.engine3D.object.dispose
Syntax
wnp.engine3D.object.dispose
Summary
Fired when a mesh is disposed of.
Event Payload:
-
object
BABYLON.MeshThe concerned mesh.
wnp.engine3D.object.refresh
Syntax
wnp.engine3D.object.refresh
Summary
Fired when an object is rebuilt.
Event Payload:
-
object
BABYLON.MeshThe refreshed mesh.