wnp.CameraFeatures Class
The Camera Features adds cool features for camera management.
Item Index
Methods
Events
Methods
buildPlaneFromBB
-
box
Builds a plane from a bounding box.
Parameters:
-
box
BABYLON.BoundingBoxA bounding box.
Returns:
A plane.
computeAnimation
-
target
-
src
-
dst
-
options
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.Meshis the animatable object that will be animate
-
src
BABYLON.Vectior3is a set of property and their value at the begin of the animation
-
dst
Objectis a set of property and their value at the end of the animation
-
options
ObjectAnimation options
-
[duration=0]
Number optionalAnimation duration in ms.
-
[callback]
Function optionalA function to call at the end of the animation.
-
[cleanAfterAnimation=true]
Boolean optionalIf true the animation will be cleaned at the end, if false, the cancel function MUST be called somewhere.
-
[name="Animation"]
String optionalA name.
-
[isACamera=false]
Boolean optionalIf 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:
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]
Computes the best camera state to focus on an object. Only works with an OrbitCamera
.
Parameters:
-
target
BABYLON.MeshThe mesh to focus on.
-
camera
BABYLON.CameraThe camera involved.
-
[viewport]
BABYLON.Viewport optionalThe viewport to use, default is (0, 0, 1, 1);
Returns:
An object where :
target
is the targetted mesh.alpha
is the alpha angle of the camera (seeOrbitCamera
doc).beta
is the beta angle of the camera (seeOrbitCamera
doc).radius
is the radius of the camera (seeOrbitCamera
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
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.MeshThe wall mesh.
Returns:
The submesh index array.
getBestFocusRadius
-
target
-
camera
-
scene
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.MeshThe mesh to focus on.
-
camera
BABYLON.CameraThe camera involved.
-
scene
BABYLON.SceneThe scene.
Returns:
radius Returns the radius to use.
makeWallsOpaque
-
[floor]
Sets all walls to opaque for a given floor.
Parameters:
-
[floor]
FloorStructure optionalA floor to make opaque. Default is the current selected floor.
onCameraMove
-
event
Tests for wall transparency.
Triggered on wnp.engine3D.camera.move
.
Parameters:
-
event
EventAn event object.
onCameraZoom
-
event
Tests for wall transparency.
Triggered on wnp.engine3D.camera.zoom
.
Parameters:
-
event
EventAn event object.
onContextChanged
-
event
Sets all walls to opaque when the 3D mode is enabled.
Triggered on wnp.contextChanged
Parameters:
-
event
EventAn event object.
onGlobaleFloorReady
-
event
Handler which will apply transparency only on walls at the current floor.
Triggered on wnp.engine3D.allFloorsReady
Parameters:
-
event
EventAn event object.
onWallsReady
-
event
Handler called when the whole walls are ready (with their subslopes).
Triggered on wnp.engine3D.subslopeOverturesReady
.
Parameters:
-
event
EventAn event object.
setCamera
-
camera
Sets the current camera for this class.
Parameters:
-
camera
BABYLON.CameraThe 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.