A camera defines your view into the virtual world. We support two types of cameras: The FreeCamera which allows users to navigate through the scene unconstrained and the ArcRotateCamera which orbits around a set of defined objects and ensures that these are always in focus. Both derive from TargetCamera which can’t be instanciated directly. All instances of TargetCamera can define a target property which either can be a position or an arry of meshes to focus on. A good introduction an cameras can be found under https://doc.babylonjs.com/divingDeeper/cameras .

  • Node

    • TargetCamera (abstract)

      • ArcRotateCamera

      • FreeCamera

TargetCamera (abstract)

{
    "type" : "TargetCamera",
    "fov" : number,
    "minZ" : number,
    "maxZ" : number,
    "position" : [ number, number, number ],
    "target" : [ number, number, number ] | [ string, ... ],
    "upVector" : [ number, number, number ]
}
JSON

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.targetcamera

FreeCamera

{
    "type" : "FreeCamera"
}
JSON

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.freecamera

ArcRotateCamera

{
    "type" : "ArcRotateCamera",
    "useAutoRotationBehavior" : boolean,
    "autoRotationBehavior" : {
        "idleRotationSpeed" : number,
        "idleRotationSpinupTime" : number,
        "idleRotationWaitTime" : number,
        "zoomStopsAnimation" : boolean
    },
    "horizontalAngle" : number,
    "verticalAngle" : number,
    "upperVerticalAngleLimit" : number,
    "lowerVerticalAngleLimit" : number,
    "radius" : number,
    "upperRadiusLimit" : number,
    "lowerRadiusLimit" : number,
    "minimumZoomLevel" : number,
    "maximumZoomLevel" : number,
    "panningSensibility" : number,
    "wheelPrecision" : number,
    "target" : string | [string]
}
JSON

RemarkhorizontalAngle is called alpha and verticalAngle is called beta in the babylon.js docs. We renamed them in our configuration file format for the sake of clarity. Furthermore, we’ve introduced an upperVerticalAngleLimit and a lowerVerticalAngleLimit which define the possible rotation range in vertical direction from 0 to 90 degree. The former limits the camera when going up, the latter when going down.

The minimumZoomLevel and the maximumZoomLevel define how close or how far the user can get to the object in a relative way. They only make sense if a target has been set. Setting the minimumZoomLevel to 0.5 means that the user can zoom out until the target fills half of the screen. Analog to this, setting the maximumZoomLevel to 2 means that the user can zoom in until the target is twice as big as it was initially.

The target parameter is used to frame certain scene elements. Here you can provide a mesh name or and array of names if you want the camera to focus on multiple elements. In that case, the joint bounding box of the meshes is used to position and orient the camera. You can also use the wildcard operator * here. This allows you to group elements using a naming schema and then focus onto all with certain prefix like e.g. foreground-*. This is especially handy with cascading as it allows you to reuse a camera configuration for different scenes.

babylon.js reference: https://doc.babylonjs.com/typedoc/classes/babylon.arcrotatecamera