API Docs for: 2.7.3
Show:

wnp.CameraFeatures Class

Module: Helpers
Parent Module: Wanaplan

The Camera Features adds cool features for camera management.

Methods

buildPlaneFromBB

(
  • box
)
BABYLON.Plane

Builds a plane from a bounding box.

Parameters:

  • box BABYLON.BoundingBox

    A bounding box.

Returns:

BABYLON.Plane:

A plane.

computeAnimation

(
  • target
  • src
  • dst
  • options
)
wnp.AnimationCancelor

Computes an animation by given an amnimatable object , source state and destination state, compute the animations babylon way and start play it

Parameters:

  • target BABYLON.Mesh

    is the animatable object that will be animate

  • src BABYLON.Vectior3

    is a set of property and their value at the begin of the animation

  • dst Object

    is a set of property and their value at the end of the animation

  • options Object

    Animation options

    • [duration=0] Number optional

      Animation duration in ms.

    • [callback] Function optional

      A function to call at the end of the animation.

    • [cleanAfterAnimation=true] Boolean optional

      If true the animation will be cleaned at the end, if false, the cancel function MUST be called somewhere.

    • [name="Animation"] String optional

      A name.

    • [isACamera=false] Boolean optional

      If set to true, the event camera.move will be triggered during the animation

    • [smooth='linear'] Smoothing interpolation. Accepted values are `"linear"`, `"ease"` or a function f : [0:1] -> [0:1] String | Function optional

Returns:

wnp.AnimationCancelor:

A function that cancels the animation on calling and cleans it up. This function will be called at the end of the animation if cleanAfterAnimation is true.

computeCameraStateLooking

(
  • target
  • camera
  • [viewport]
)
Object

Computes the best camera state to focus on an object. Only works with an OrbitCamera.

Parameters:

  • target BABYLON.Mesh

    The mesh to focus on.

  • camera BABYLON.Camera

    The camera involved.

  • [viewport] BABYLON.Viewport optional

    The viewport to use, default is (0, 0, 1, 1);

Returns:

Object:

An object where :

  • target is the targetted mesh.
  • alpha is the alpha angle of the camera (see OrbitCamera doc).
  • beta is the beta angle of the camera (see OrbitCamera doc).
  • radius is the radius of the camera (see OrbitCamera doc).

dynamicWallTransparency

()

Applies transparency to wall materials based on the position and target of the camera. Used to see through walls and roofs.

fillByZIndex

(
  • wallMesh
)
Array

This function is related to the wall transparency.
Builds an index array corresponding to the submesh indexes in the wall mesh.
These submeshes must be transparent to have a clear display of the camera target.
This is only relevant if the wall transparency option is active.

Parameters:

  • wallMesh BABYLON.Mesh

    The wall mesh.

Returns:

Array:

The submesh index array.

getBestFocusRadius

(
  • target
  • camera
  • scene
)
Number

Gets the best focus radius for the camera to be in the best setup, in order to see the whole mesh.
N.B : The current position and target of the camera is irrelevant, this function will work anyway.

Parameters:

  • target BABYLON.Mesh

    The mesh to focus on.

  • camera BABYLON.Camera

    The camera involved.

  • scene BABYLON.Scene

    The scene.

Returns:

Number:

radius Returns the radius to use.

makeWallsOpaque

(
  • [floor]
)

Sets all walls to opaque for a given floor.

Parameters:

  • [floor] FloorStructure optional

    A floor to make opaque. Default is the current selected floor.

onCameraMove

(
  • event
)
private

Tests for wall transparency. Triggered on wnp.engine3D.camera.move.

Parameters:

  • event Event

    An event object.

onCameraZoom

(
  • event
)
private

Tests for wall transparency. Triggered on wnp.engine3D.camera.zoom.

Parameters:

  • event Event

    An event object.

onContextChanged

(
  • event
)
private

Sets all walls to opaque when the 3D mode is enabled. Triggered on wnp.contextChanged

Parameters:

  • event Event

    An event object.

onGlobaleFloorReady

(
  • event
)
private

Handler which will apply transparency only on walls at the current floor. Triggered on wnp.engine3D.allFloorsReady

Parameters:

  • event Event

    An event object.

onWallsReady

(
  • event
)
private

Handler called when the whole walls are ready (with their subslopes). Triggered on wnp.engine3D.subslopeOverturesReady.

Parameters:

  • event Event

    An event object.

setCamera

(
  • camera
)

Sets the current camera for this class.

Parameters:

  • camera BABYLON.Camera

    The camera to use.

startTransparency

()

Starts the transparency when the user clicks on the transparency button.

stopTransparency

()

Stops the wall transparency when the user clicks on the transparency button.

Events

wnp.engine3D.camera.move

Fired when the 3D camera has moved.