WanaPlan

API Docs for: 2.7.0
Show:

ObjectComponent3D

Extends BaseComponent3D
Module: Component
Parent Module: Wanaplan

Summary

Handles the 3D object instanciation for wanaplan.

Constructor

ObjectComponent3D

Syntax

ObjectComponent3D

(
  • core
)

Summary

Parameters:

  • core Core

    The main engine.

Methods

addObjectToScene

Syntax

addObjectToScene

(
  • object3d
  • structureObject
  • floorStructure
  • [callback]
  • [silent=false]
)
private

Summary

Prepares the 3D object to be added to the scene, according to its ObjectStructure

Parameters:

  • object3d BABYLON.Mesh

    The mesh of the object.

  • structureObject ObjectStructure

    The object structure to be added.

  • floorStructure FloorStructure

    The floor where the object will be appended.

  • [callback] Function optional

    The function called after the object is built.

  • [silent=false] Boolean optional

    If true, no event will be thrown at the object creation.

applyShadow

Syntax

applyShadow

(
  • UNKNOWN
)
private static

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 ObjectStructure

    The object structure to be instanciated.

  • params Object

    Params of the object to be instanciated such as defined in the relevant programmable.

    • [materials] BABYLON.Material optional

      Contains labeled materials. If the materials are already defined in objectStructure.programmableInstance, this will have no effect.

  • [floorStructure] FloorStructure optional

    The floor where the object will be appended, default is the current floor.

  • [callback] Function optional

    The function called after the object is built.

  • [silent=false] Boolean optional

    If true, no event will be thrown at the object creation.

compute

Inherited from BaseComponent3D:

Syntax

compute

() private

Summary

Recompute of the component.

destroy

Inherited from BaseComponent3D:

Syntax

destroy

()

Summary

Destructor.

disable

Inherited from BaseComponent3D:

Syntax

disable

()

Summary

Disables the component

enable

Inherited from BaseComponent3D:

Syntax

enable

()

Summary

Enables the component

getFloor

Inherited from BaseComponent3D:

Syntax

getFloor

(
  • [structure]
)
BABYLON.Mesh

Summary

Gets the 3D mesh of the floor structure in parameter (by default current floor).

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

getValue

Syntax

getValue

(
  • targetValue
  • defaultValue
)
Object private static

Summary

Gets a value from the parameter. If parameter is undefined then returns the default value.

Parameters:

  • targetValue Object

    parameter to get the value from

  • defaultValue Object

    default value to use if value of targetValue is undefined.

Returns:

Object:

value of targetValue if not undefined, else defaultValue.

getVector3

Syntax

getVector3

(
  • pVector
)
BABYLON.Vector3 private static

Summary

Gets a type Vector3 object from a litteral JavaScript object with 3 components x, y, z.

Parameters:

  • pVector Object

    A litteral object with 3 components x, y, z.

Returns:

BABYLON.Vector3:

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

Inherited from BaseComponent3D:

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 Event

    The JS event.

onAddObject

Syntax

onAddObject

(
  • event
)
ObjectStructure

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 Event

    The JS event.

Returns:

ObjectStructure:

The created object structure.

onContextChanged

Inherited from BaseComponent3D:

Syntax

onContextChanged

(
  • context
)

Summary

Method called when the context is switched (2D -> 3D or 3D -> 2D)

Parameters:

  • context String

    The 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 Event

    The JS event.

onRemoveObject

Syntax

onRemoveObject

(
  • event
)

Summary

Removes a 3D object from the scene. Triggered on event wnp.engine3D.object.remove.

Parameters:

  • event Event

    The 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.Mesh

    The mesh object, as defined in wanaplan. It should declare a reference to the objectStructure ( meshObject.structure ).

  • [callback] Function optional

    The function called once the object is built. Takes the new mesh as its only parameter.

startListening

Inherited from BaseComponent3D:

Syntax

startListening

()

Summary

Calls all the event listeners.

stopListening

Inherited from BaseComponent3D:

Syntax

stopListening

()

Summary

Removes all the event listeners.

update

Inherited from BaseComponent3D:

Syntax

update

(
  • deltaTime
)

Summary

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

Properties

keyboardManager

Inherited from BaseComponent3D:

Syntax

keyboardManager

wnp.KeyboardManager

Summary

Instance of the Keyboard Manager (shortcut to wanaplan.keyboardManager).

name

Inherited from BaseComponent3D:

Syntax

name

String

Summary

Name of the component.

structure

Inherited from BaseComponent3D:

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.Mesh

    The created mesh.

  • objectStructure ObjectStructure

    The involved object structure.

wnp.engine3D.object.dispose

Syntax

wnp.engine3D.object.dispose

Summary

Fired when a mesh is disposed of.

Event Payload:

  • object BABYLON.Mesh

    The concerned mesh.

wnp.engine3D.object.refresh

Syntax

wnp.engine3D.object.refresh

Summary

Fired when an object is rebuilt.

Event Payload:

  • object BABYLON.Mesh

    The refreshed mesh.

wnp.menu.main.add

Syntax

wnp.menu.main.add

Summary

Fired to add a menu item to the main menu.