Camera class

The Camera class provides interfaces to control the 3D camera.

Signature:

export default class Camera 

Properties

PropertyModifiersDescription
core
cores

Methods

MethodDescription
getData()Return the current scene camera data.
project(modelPosition, modelMatrix)Project a position into screen space
setData(data, animation)Set the scene camera use data.
setFirstPersonViewEnabled(enabled)Switch between 1st person view and 3rd person view.
setFov(fov)Set the field of view value of scene camera.
setMaxPitchAngle(angle)Set max pitch angle of the camera. Once reach the limit value, the camera's picth angle would not increase.
setMaxTargetDistanceRatio(value)The maximum distance from camera to target.
setMinPitchAngle(angle)Set min pitch angle of the camera. Once reach the limit value, the camera's picth angle would not decrease.
setMinTargetDistanceRatio(value)The minimum distance from camera to target.
setNearPlaneDistanceRatio(value)Set the minimum distance from camera to z near plane.
switchToView(view)Switch to certain view
switchToWorldView()switch camera to the original view.
transformToOrthogonal()Convert to orthogonal projection while keeping the projection result of current frame.
transformToPerspective()Convert to perspective projection while keeping the projection result of current frame.
unproject(x, y)Unproject a screen space coordinate to 3d coord.