API Docs for: 2.7.3
Show:

ObjectStructure Class

Extends BaseStructure
Module: Component
Parent Module: Wanaplan

Structure of an object.

Constructor

ObjectStructure

(
  • fileName
  • baseUrl
  • transforms
  • builderId
)

Parameters:

  • fileName String

    name of the programmable file

  • baseUrl String

    path to the programmable file

  • transforms Object

    object containing the transform properties of the object with fields : position, rotation, scaling, modelRotation, preferredYAngle

  • builderId String

    name of the builder

Methods

add

(
  • propertyName
  • value
)
private

Inherited from BaseStructure:

Adds an element to the collection in parameter.

Parameters:

  • propertyName String
    Name of the dictionnary.
  • value Object
    Value to distribute.

Returns:

Returns true if the value is added else returns false.

animate

(
  • object
  • target
)

Animates an animatable object. Since objects can have multiple animations for their multiple meshes, pass the targeted mesh in parameter.

NB : This is a shortcut to Programmable.animate.

Parameters:

  • object BABYLON.Mesh

    The mesh of the object.

  • target BABYLON.Mesh

    The specific mesh which should be animated.

checkCoherence

(
  • structure
)

Checks if the object structure contains errors, and if so removes it

Parameters:

  • structure FloorStructure

    The floorStructure to which the object belongs

clone

() ObjectStructure

Clones the object, making a deep copy.

Returns:

ObjectStructure:

A new instance of the object, with the same attributes.

deserialize

(
  • hybrid
)
Object

Inherited from BaseStructure:

Deserializes the object (from JSON).

Parameters:

  • hybrid Object
    JSON describing the object, built with the method serialize.

Returns:

Object: The Structure object built from the deserialization

getAvailableProperties

() Object

Get the available properties of the programmable instance.

NB : This is a shortcut to Programmable.getAvailableProperties.

Returns:

Object:

An object containing the programmable properties.

getElementByName

(
  • name
  • collection
)
Object private

Inherited from BaseStructure:

Gets an element of the collection by its name.

Parameters:

  • name String
    The name of the element to search.
  • collection String
    The name of the collection in which we want to search. If this parameter is not defined, the search is done in all the collection of type array.

Returns:

Object: Returns the needed element if it exists, else returns null.

getFloor

(
  • collection
)
FloorStructure

Inherited from BaseStructure:

Gets the floor referencing this object

Parameters:

  • collection String
    Collection to search within.

Returns:

FloorStructure: The floor containing this structure, -1 if the object has not been added to any floor collection.

getMaterial

(
  • name
)
BABYLON.Material

Gets the material of a given mesh or child mesh.

Parameters:

  • name String

    The mesh name, this mesh must be objectStructure.objectInstance or one of its children.

Returns:

BABYLON.Material:

The material.

initialize

() private

Inherited from BaseStructure:

Method called after the loading of the component

isPropertyLocked

(
  • key
)
Boolean

Check if a property is locked or not, based on backoffice directives

Parameters:

Returns:

serialize

() Object

Inherited from BaseStructure:

Serializes the object (to JSON)

Returns:

Object: The serialization result, null if nothing is serialized

setMaterial

(
  • material
  • name
)

Sets the material of a named mesh.

Parameters:

  • material BABYLON.Material

    The new Material.

  • name String

    The mesh name, this mesh must be objectStructure.objectInstance or one of its children.

update

()

Inherited from BaseStructure:

Generic update method, must be overridden.

updateReferences

(
  • structure
)

Inherited from BaseStructure:

Generic method for rebuilding references after the deserialization. For example : restoring the link between a PointStructure and its parent WallStructure

Parameters:

  • structure wnp.Structure

    Floor Structure to work with

Properties

baseUrl

String

The path to the programmable file, such as /js/Programmables/ . This supports http requests such as : http://github.com/wanadev/Programmables/

filename

String

The name of the programmable file, such as MyProgrammable.js

id

Number

Inherited from BaseStructure:

Unique ID for the structure set up automatically

name

String

Inherited from BaseStructure:

Structure name

objectInstance

BABYLON.Mesh

A reference to the mesh.

position

BABYLON.Vector3

A reference to the mesh position.

/!\ This is a reference to this.objectInstance.position and not a copy, breaking the reference will result in hard failure in serialization.

preferredYAngle

Number

Defines an optimal angle for the object. The object is well positioned when the angle between its x axis and a wall is equals to this value. This value is used by the magnetism algorithm to make the objects face the right direction. Angle must be k * Pi/2, else it will probably give unwanted result.

programmableInstance

Programmable

A reference to the programmable.

ready

Boolean

Flag to indicate if the object is fully loaded.

Default: false

rotation

BABYLON.Vector3

A reference to the mesh rotation.

/!\ This is a reference to this.objectInstance.rotation and not a copy, breaking the reference will result in hard failure in serialization.

scaling

BABYLON.Vector3

A reference to the mesh scaling

/!\ This is a reference to this.objectInstance.scaling and not a copy, breaking the reference will result in hard failure in serialization.