API Docs for: 2.7.3
Show:

ObjectComponent3D Class

Extends BaseComponent3D
Module: Component
Parent Module: Wanaplan

Handles the 3D object instanciation for wanaplan.

Constructor

ObjectComponent3D

(
  • core
)

Parameters:

  • core Core

    The main engine.

Methods

addObjectToScene

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

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

(
  • UNKNOWN
)
private static

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

() private

Inherited from BaseComponent3D:

Recompute of the component.

destroy

()

Inherited from BaseComponent3D:

Destructor.

disable

()

Inherited from BaseComponent3D:

Disables the component

enable

()

Inherited from BaseComponent3D:

Enables the component

getFloor

(
  • [structure]
)
BABYLON.Mesh

Inherited from BaseComponent3D:

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

Parameters:

Returns:

BABYLON.Mesh:

The floor mesh in 3D.

getValue

(
  • targetValue
  • defaultValue
)
Object private static

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

(
  • pVector
)
BABYLON.Vector3 private static

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:

Method called when Wanaplan is initialized. You don't need to call this method manually.

onAddGroup

(
  • event
)

Adds a group of 3D objects to the current floor. Triggered on event wnp.engine3D.addGroup.

Parameters:

  • event Event

    The JS event.

onAddObject

(
  • event
)
ObjectStructure

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

(
  • context
)

Inherited from BaseComponent3D:

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

Parameters:

  • context String

    The new context

onFloorReady

(
  • event
)

When a floor is ready, creates the objects it contains. Triggered on event wnp.engine3D.floorReady.

Parameters:

  • event Event

    The JS event.

onRemoveObject

(
  • event
)

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

Parameters:

  • event Event

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

Calls all the event listeners.

stopListening

()

Inherited from BaseComponent3D:

Removes all the event listeners.

update

(
  • deltaTime
)

Inherited from BaseComponent3D:

Updates the dynamic part of the component.

Parameters:

  • deltaTime Number
    The time interval.

Properties

keyboardManager

wnp.KeyboardManager

Inherited from BaseComponent3D:

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

name

String

Inherited from BaseComponent3D:

Name of the component.

structure

wnp.Structure

Inherited from BaseComponent3D:

Instance of the structure (shortcut to wanaplan.structure).

Events

wnp.engine3D.object.create

Fired when an object is created.

Event Payload:

  • object BABYLON.Mesh

    The created mesh.

  • objectStructure ObjectStructure

    The involved object structure.

wnp.engine3D.object.dispose

Fired when a mesh is disposed of.

Event Payload:

  • object BABYLON.Mesh

    The concerned mesh.

wnp.engine3D.object.refresh

Fired when an object is rebuilt.

Event Payload:

  • object BABYLON.Mesh

    The refreshed mesh.

wnp.menu.main.add

Fired to add a menu item to the main menu.