WanaPlan

API Docs for: 2.7.0
Show:

API.e3D

Module: API
Parent Module: Wanaplan

Summary

API for wanaplan's 3D engine.

Constructor

API.e3D

Syntax

API.e3D

()

Summary

Methods

addProgrammable

Syntax

addProgrammable

(
  • filename
  • [params]
)
ObjectStructure

Summary

Builds a 3D programmable object on the scene.

Parameters:

  • filename String

    The file name of the programmable.

  • [params] Object optional

    A set of parameters for this programmable

    • [materials] Object optional

      A set of serialized materials for this programmable object, that will override default materials.
      See getDefaultMaterials documentation in the Programmable class.

    • [params] Object optional

      A set of serialized parameters to build the geometry of this programmable object, that will override default params. See getDefaultParams documentation in the Programmable class.

    • [floor] FloorStructure optional

      Floor that will contain the object. Default is the current floor.

    • [position] BABYLON.Vector3 optional

      Position of the object. Default is the avatar position.

    • [rotation] BABYLON.Vector3 optional

      Rotation of the object. Default is none.

    • [customData] Object optional

      Custom data that will be serialized along with the programmable.

Returns:

ObjectStructure:

The resulting object structure, watch for the ready flag.

addToGroup

Syntax

addToGroup

(
  • object
  • group
  • [isHistoryAction]
)
BABYLON.Mesh

Summary

Adds an object to a group.

Parameters:

  • object BABYLON.Mesh

    A group or an object.

  • group BABYLON.Mesh

    A group, an object or null.

  • [isHistoryAction] Boolean optional

    Add to the history or not.

Returns:

BABYLON.Mesh:

The new group.

addWidget

Syntax

addWidget

(
  • path
  • widgetName
)

Summary

Adds a widget with the url and the name of the widget. Important widget function.

Parameters:

  • path String

    The url of the widget.

  • widgetName String

    The name of widget.

castShadows

Syntax

castShadows

(
  • mesh
)

Summary

Casts the shadows induced by the given mesh. Beware, this is an expensive feature, performance may be altered.

Parameters:

  • mesh BABYLON.Mesh

    The mesh

deselectObject

Syntax

deselectObject

()

Summary

Deselects any selected object and sets the currently selected object to null.

getCamera

Syntax

getCamera

() BABYLON.Camera

Summary

Returns the active camera of the 3D scene

Returns:

BABYLON.Camera:

The active camera

getCameraFeatures

Syntax

getCameraFeatures

() wnp.CameraFeatures

Summary

Returns an object containing some useful features to interact with the camera. See wnp.CameraFeatures documentation for a detailed review of all features.

Returns:

wnp.CameraFeatures:

The camera features

getCameraId

Syntax

getCameraId

() Number

Summary

Gets the active camera's Id.

Returns:

Number:

The current camera Id

getCanvas

Syntax

getCanvas

() HTMLCanvasElement

Summary

Gets the 3D render canvas used by the 3D view.

Returns:

HTMLCanvasElement:

the 3D canvas.

getGround

Syntax

getGround

() BABYLON.Mesh

Summary

Returns the cubic mesh acting as the ground.

Returns:

BABYLON.Mesh:

The ground

getInstance

Syntax

getInstance

(
  • mousePos
)
wnp.BaseStructure

Summary

Gets the instance of the object picked by the given mouse position.

Parameters:

  • mousePos BABYLON.Vector2

    The mouse position on the screen.

Returns:

wnp.BaseStructure:

The instance of the mesh.

getMaterialFromMousePosition

Syntax

getMaterialFromMousePosition

(
  • mousePos
)
BABYLON.Material

Summary

Gets the material of the object picked by the given mouse position.

Parameters:

  • mousePos BABYLON.Vector2

    The mouse position on the screen.

Returns:

BABYLON.Material:

The material of the selected mesh.

getMeshByName

Syntax

getMeshByName

() BABYLON.Mesh

Summary

Searches for a mesh by its name.

Returns:

BABYLON.Mesh:

The mesh if found, null if not.

getMeshes

Syntax

getMeshes

() BABYLON.Mesh

Summary

Gets all meshes in the scene

Returns:

BABYLON.Mesh:

An array of all meshes.

getObjects

Syntax

getObjects

() BABYLON.Mesh

Summary

Gets all handleable objects in the scene

Returns:

BABYLON.Mesh:

An array of all 3D handleable meshes.

getPickingInfo

Syntax

getPickingInfo

(
  • mousePos
)
BABYLON.PickingInfo

Summary

Gets information on the mesh picked by the given mouse position. The picking information contains :

  • bu, bv : Information on the uv of the picked mesh
  • distance : The distance from the camera to the picked point
  • faceId : The face id of the mesh
  • hit : If it hit a mesh or not
  • pickedMesh : The collided mesh
  • pickedPoint : The point on the collided mesh
  • pickedSubMeshIndex : The index of the submesh

Parameters:

  • mousePos BABYLON.Vector2

    The mouse position on the screen.

Returns:

BABYLON.PickingInfo:

The collision information.

getRoomMesh

Syntax

getRoomMesh

() BABYLON.Mesh

Summary

Gets the mesh of the room for the active floor.

Returns:

BABYLON.Mesh:

The room as a 3D mesh.

getScene

Syntax

getScene

() BABYLON.Scene

Summary

Returns the current scene

Returns:

BABYLON.Scene:

The current 3D scene

getSelectedObject

Syntax

getSelectedObject

() BABYLON.Mesh

Summary

Gets the currently selected object

Returns:

BABYLON.Mesh:

The currently selected object.

getSkySphere

Syntax

getSkySphere

() BABYLON.Mesh

Summary

Returns the spheric mesh acting as the sky

Returns:

BABYLON.Mesh:

The sky

getSunlight

Syntax

getSunlight

() BABYLON.DirectionalLight

Summary

Returns the directional light acting as the sun

Returns:

BABYLON.DirectionalLight:

The sun

getTopLevelMeshes

Syntax

getTopLevelMeshes

() BABYLON.Mesh

Summary

Gets all top-level meshes of the scene (the parent of which is directly the floor, or a group)

Returns:

BABYLON.Mesh:

An array of all top-level 3D meshes.

import3DModel

Syntax

import3DModel

(
  • url
  • [params]
  • successCallback
  • errorCallback
)

Summary

Imports a 3D model from an URL, using ASSIMP library. For supported formats, see assimp project.

Parameters:

  • url String

    The URL where the 3D model can be found, it can be an URL to a raw model or an URL to a zip file. Notice that if you use a zip file, the model and the textures must be added to the root of the archive. You can specify a string from a model (DAE, OBJ, STL, or JSON) as URL but you need to set the value of params.ext with the correct extension (ex. params.ext = "dae").

  • [params] Object optional

    A set of parameters for this programmable. See addProgrammable For the available nested parameters.

    • [ext] String optional

      If specified, it means the url parameter is a string decribing the model, and this parameter indicates its extension. Can be "dae", "obj", "stl" or "json".

  • successCallback Function

    A function called when the structure is ready. This function will take one parameter, which is the created ObjectStructure.

  • errorCallback Function

    A function called if the process fail.

lock

Syntax

lock

(
  • key
  • [flags]
)

Summary

Disables behaviors.

Parameters:

  • key Object

    Can be anything, is registered as key for the lock, the action will be unlocked only with the same key

  • [flags] Number optional

    Actions to lock among : CAMERALOCK = 1; DRAGLOCK = 2; KEYBOARDLOCK = 4; CAMERATRANSLATIONLOCK = 8; Default is all flags on.

projectOnPlane

Syntax

projectOnPlane

(
  • plane
  • [x]
  • [y]
)
BABYLON.Vector3

Summary

Projects a screen position (by default the mouse position) on a 3D plane.

Parameters:

  • plane BABYLON.Plane

    The 3D plane

  • [x] Number optional

    The x coordinate

  • [y] Number optional

    The y coordinate

Returns:

BABYLON.Vector3:

The projected point

selectObject

Syntax

selectObject

(
  • object
)

Summary

Sets an object as the currently selected object.

Parameters:

  • object BABYLON.Mesh

    The object to select.

setCameraById

Syntax

setCameraById

(
  • cameraId
)

Summary

Switches the type of the camera according to a given Id.

Parameters:

  • cameraId Number

    Must be API.e3D.ORBITCAMERA or API.e3D.FPSCAMERA, depending on the desired camera

setMaterialFromMousePosition

Syntax

setMaterialFromMousePosition

(
  • mousePos
  • material
)

Summary

Sets the material of the object picked by the given mouse position.

Parameters:

  • mousePos BABYLON.Vector2

    The mouse position on the screen.

  • material BABYLON.Material

    The new material.

setRoomCeilingMaterial

Syntax

setRoomCeilingMaterial

(
  • material
)

Summary

Sets the default material for the ceiling of the room

Parameters:

  • material BABYLON.Material

    The new material.

setRoomFloorMaterial

Syntax

setRoomFloorMaterial

(
  • material
)

Summary

Sets the default material for the floor of the room

Parameters:

  • material BABYLON.Material

    The new material.

switchCamera

Syntax

switchCamera

()

Summary

Switches camera (between first person and orbit)

uncastShadows

Syntax

uncastShadows

(
  • mesh
)

Summary

Disables the casting of shadows by this mesh

Parameters:

  • mesh BABYLON.Mesh

    The mesh

unlock

Syntax

unlock

(
  • key
  • [flags]
)

Summary

Re-enables locked behaviors.

Parameters:

  • key Object

    Key that was used to lock actions

  • [flags] Number optional

    Actions to unlock among: CAMERALOCK = 1; DRAGLOCK = 2; KEYBOARDLOCK = 4; CAMERATRANSLATIONLOCK = 8; Default is all flags on.

Properties

CAMERALOCK

Syntax

CAMERALOCK

Number

Summary

CAMERATRANSLATIONLOCK

Syntax

CAMERATRANSLATIONLOCK

Number

Summary

DRAGLOCK

Syntax

DRAGLOCK

Number

Summary

FPSCAMERA

Syntax

FPSCAMERA

Number

Summary

KEYBOARDLOCK

Syntax

KEYBOARDLOCK

Number

Summary

ORBITCAMERA

Syntax

ORBITCAMERA

Number

Summary

Events

wnp.engine3D.cameraChanged

Syntax

wnp.engine3D.cameraChanged

Summary

Fired when the user changes the camera.

wnp.request.historyAction

Syntax

wnp.request.historyAction

Summary

Fired when an object is refreshed and if the history is needed.

Event Payload:

  • component BaseComponent3D

    The component of the action

  • object BABYLON.Mesh

    The target.

  • params Object

    Params of the history.

  • action String

    The type of action done.