Module: camera

API for controlling the camera within the bounds of the current camera model. Use Transform API for low-level actions.
All functions require a valid camera object reference. Use scenes.get_object_by_name() or scenes.get_active_camera() to obtain it. The result of applying various transforms to a camera can be overridden by the present camera limits.

API examples for this module: English, 中文, Русский.

Summary

Members

Methods

Type Definitions

Detailed Description

Members

MS_EYE_CONTROLS

The camera's movement style: EYE.
Type:
Source:

MS_HOVER_CONTROLS

The camera's movement style: HOVER.
Type:
Source:

MS_STATIC

The camera's movement style: STATIC (non-interactive).
Type:
Source:

MS_TARGET_CONTROLS

The camera's movement style: TARGET.
Type:
Source:

Methods

calc_ray(camobj, canvas_x, canvas_y, destopt, nullable) → (nullable) {ParametricLine}

Calculate the direction of the camera ray based on the Canvas coordinates. The origin of the Canvas space is located in the top left corner of the Canvas.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
canvas_x number X Canvas coordinate.
canvas_y number Y Canvas coordinate.
dest ParametricLine <optional>
<nullable>
new Float32Array(6); Destination parametric line.
Returns:
Destination parametric line.
Type
ParametricLine
Source:

correct_up(camobj, z_axisopt, strictopt)

Correct the UP vector of the camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
z_axis Vec3 <optional>
util.AXIS_Z Axis vector.
strict boolean <optional>
false Align camera exactly with the direction of the given axis vector (never with the opposite direction).
Source:

eye_get_horizontal_limits(camobj, destopt, nullable, localopt) → (nullable) {HorizontalRotationLimits}

Get horizontal angle limits of the EYE camera (converted to the [0, 2Pi] range).
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest HorizontalRotationLimits <optional>
<nullable>
new Object(); The receiving object.
local boolean <optional>
false Use camera local space representation.
Returns:
Horizontal rotation limits or null if disabled.
Type
HorizontalRotationLimits
Source:
See:

eye_get_vertical_limits(camobj, destopt, nullable, localopt) → (nullable) {VerticalRotationLimits}

Get vertical rotation limits of the EYE camera (converted to the [-Pi, Pi] range).
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest VerticalRotationLimits <optional>
<nullable>
new Object(); The receiving object.
local boolean <optional>
false Use camera local space representation.
Returns:
Vertical rotation limits or null if disabled.
Type
VerticalRotationLimits
Source:
See:

eye_rotate(camobj, phi, theta, is_absopt)

Rotate the EYE camera counterclockwise (CCW) around its origin by the given angles. Performs delta rotation or sets the camera's absolute rotation depending on the "is_abs" parameter.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi number Azimuth angle in radians.
theta number Elevation angle in radians.
is_abs boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
Deprecated since 17.06:
Source:
See:

eye_set_horizontal_limits(camobj, limitsopt, nullable)

Set horizontal rotation limits for the EYE camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
limits HorizontalRotationLimits <optional>
<nullable>
null Horizontal rotation limits. Pass null to disable the limits.
Source:
See:

eye_set_look_at(camobj, posopt, nullable, look_atopt, nullable)

Set position and orientation for the EYE camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
pos Vec3 <optional>
<nullable>
null Position of the camera. Pass null to keep the current camera position.
look_at Vec3 <optional>
<nullable>
null Point the camera is looking at. Pass null to keep the existing camera orientation.
Source:

eye_set_vertical_limits(camobj, limitsopt, nullable)

Set vertical rotation limits for the EYE camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
limits VerticalRotationLimits <optional>
<nullable>
null Vertical rotation limits. Pass null to disable the limits.
Source:
See:

eye_setup(camobj, paramsopt, nullable)

Setup the EYE camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
params EyeCameraParams <optional>
<nullable>
null The parameters of the EYE camera.
Source:

get_camera_angles(camobj, destopt, nullable) → (nullable) {Vec2}

Get the angles of horizontal (azimuth) and vertical (elevation) rotation (CCW as seen from the rotation axis) of the TARGET/HOVER camera, or the analogous orientation angles of the EYE camera. Intended for the cameras with corrected up vector.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec2 <optional>
<nullable>
new Float32Array(2); Destination vector for the camera angles (in radians): [phi, theta], phi: [0, 2Pi], theta: [-Pi, Pi].
Returns:
Destination vector for the camera angles (in radians): [phi, theta].
Type
Vec2
Source:
See:

get_camera_angles_char(camobj, destopt, nullable) → (nullable) {Vec2}

Get the angles of horizontal (azimuth) and vertical (elevation) rotation (CCW as seen from the rotation axis) of the TARGET/HOVER camera, or the analogous orientation angles of the EYE camera. The angles are converted for the character object. Intended for the cameras with corrected up vector.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec2 <optional>
<nullable>
new Float32Array(2); Destination vector for the camera angles (in radians): [phi, theta], phi: [0, 2Pi], theta: [-Pi, Pi].
Returns:
Destination vector for the camera angles (in radians): [phi, theta].
Type
Vec2
Source:
See:

get_camera_angles_dir(dir, destopt, nullable) → (nullable) {Vec2}

Get the angles of horizontal (azimuth) and vertical (elevation) rotation (CCW as seen from the rotation axis) of the TARGET/HOVER camera, or the analogous orientation angles of the EYE camera from the given direction representing the view vector of the camera, which up vector is vertically aligned.
Parameters:
Name Type Attributes Default Description
dir Vec3 Direction representing the view vector of the camera.
dest Vec2 <optional>
<nullable>
new Float32Array(2); Destination vector for the camera angles (in radians): [phi, theta], phi: [0, 2Pi], theta: [-Pi, Pi].
Returns:
Destination vector for the camera angles (in radians): [phi, theta].
Type
Vec2
Source:
See:
Example
var m_cam = require("camera");
var m_vec3 = require("vec3");

var view_vec = m_vec3.fromValues(10, 5, -3);
var angles = new Float32Array(2);
m_cam.get_camera_angles_dir(view_vec, angles);
var phi = angles[0], theta = angles[1];

get_eye_distance(camobj) → {number}

Get the distance between eyes of the stereoscopic camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Distance between eyes.
Type
number
Source:

get_fov(camobj) → {number}

Get the vertical angle of the camera's field of view.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Camera field of view (in radians).
Type
number
Source:

get_frustum_planes(camobj, planes) → (nullable) {FrustumPlanes}

Get camera frustum planes.
Parameters:
Name Type Description
camobj Object3D Camera object.
planes FrustumPlanes Frustum planes object.
Returns:
Frustum planes object.
Type
FrustumPlanes
Source:

get_move_style(camobj) → (nullable) {CameraMoveStyle}

Get movement style of the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Camera movement style.
Type
CameraMoveStyle
Source:

get_ortho_scale(camobj) → {number}

Get the orthogonal scale of the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Orthogonal scale.
Type
number
Source:

get_stereo_distance(camobj) → {number}

Get the distance from the convergence plane of the stereoscopic camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Distance from convergence plane.
Type
number
Source:

get_translation(camobj, destopt) → (nullable) {Vec3}

Get the camera's translation vector.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec3 <optional>
new Float32Array(3); Destination vector.
Returns:
Destination vector.
Type
Vec3
Source:

get_velocities(camobj, dest) → (nullable) {VelocityParams}

Get velocity parameters of the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
dest VelocityParams The receiving object.
Returns:
Velocity parameters.
Type
VelocityParams
Source:

get_vertical_axis(camobj, destopt, nullable) → (nullable) {Vec3}

Get vertical axis of the camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec3 <optional>
<nullable>
m_vec3.create(); Destination vector.
Returns:
Destination vector.
Type
Vec3
Source:

get_view_vector(camobj, destopt, nullable) → (nullable) {Vec3}

Get camera view vector in world space.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec3 <optional>
<nullable>
new Float32Array(3); Destination vector.
Returns:
Destination vector.
Type
Vec3
Source:

has_distance_limits(camobj) → {boolean}

Check whether the camera has distance limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

has_horizontal_rot_limits(camobj) → {boolean}

Check whether the camera has any horizontal rotation limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

has_horizontal_trans_limits(camobj) → {boolean}

Check whether the camera has any horizontal translation limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

has_vertical_rot_limits(camobj) → {boolean}

Check whether the camera has any vertical rotation limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

has_vertical_trans_limits(camobj) → {boolean}

Check whether the camera has any vertical translation limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

hover_get_distance(camobj) → {number}

Get distance to the pivot point for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Distance to the pivot.
Type
number
Source:

hover_get_distance_limits(camobj, destopt, nullable) → (nullable) {DistanceLimits}

Get distance limits of the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest DistanceLimits <optional>
<nullable>
new Object(); The receiving object.
Returns:
Distance limits.
Type
DistanceLimits
Source:

hover_get_horiz_trans_limits(camobj, destopt, nullable) → (nullable) {HorizontalTranslationLimits}

Get horizontal translation limits of the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest HorizontalTranslationLimits <optional>
<nullable>
new Object(); The receiving object.
Returns:
Horizontal translation limits or null if disabled.
Type
HorizontalTranslationLimits
Source:
See:

hover_get_pivot(camobj, destopt) → (nullable) {Vec3}

Get pivot position of the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec3 <optional>
new Float32Array(3); Destination vector for the pivot translation.
Returns:
Destination vector for the pivot translation.
Type
Vec3
Source:

hover_get_vert_trans_limits(camobj, destopt, nullable) → (nullable) {VerticalTranslationLimits}

Get vertical translation limits of the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest VerticalTranslationLimits <optional>
<nullable>
new Object(); The receiving object.
Returns:
Vertical translation limits or null if disabled.
Type
VerticalTranslationLimits
Source:
See:

hover_get_vertical_limits(camobj, destopt, nullable) → (nullable) {HoverAngleLimits}

Get vertical rotation (hover angle) limits for the HOVER camera (converted to the [-Pi, 0] range).
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest HoverAngleLimits <optional>
<nullable>
new Object(); The receiving object.
Returns:
Hover angle limits.
Type
HoverAngleLimits
Source:
See:

hover_rotate(camobj, phi, theta, is_absopt)

Rotate the HOVER camera around its pivot by the given angles. Performs delta rotation or sets the camera's absolute rotation depending on the "is_abs" parameter.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi number Azimuth angle in radians
theta number Elevation angle in radians
is_abs boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
Deprecated since 17.06:
Source:
See:

hover_set_distance_limits(camobj, limits)

Set distance limits for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
limits DistanceLimits Distance limits.
Source:

hover_set_horiz_trans_limits(camobj, limitsnullable)

Set horizontal (along the X axis) translation limits for the HOVER camera.
Parameters:
Name Type Attributes Description
camobj Object3D Camera 3D-object.
limits HorizontalTranslationLimits <nullable>
Horizontal translation limits. Pass null to disable the limits.
Source:
See:

hover_set_pivot_translation(camobj, trans)

Performs parallel translation for the HOVER camera. It works as similar as the set_translation() method but uses the camera pivot to perform the translation.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
trans Vec3 New pivot position.
Source:

hover_set_vert_trans_limits(camobj, limitsnullable)

Set vertical (along the Z axis) translation limits for the HOVER camera.
Parameters:
Name Type Attributes Description
camobj Object3D Camera 3D-object.
limits VerticalTranslationLimits <nullable>
Vertical translation limits. Pass null to disable the limits.
Source:
See:

hover_set_vertical_limits(camobj, limits)

Set vertical rotation (hover angle) limits for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
limits HoverAngleLimits Hover angle limits
Source:
See:

hover_setup(camobj, params)

Setup HOVER camera model.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
params HoverCameraParams The parameters of the HOVER camera.
Source:

hover_setup_rel(camobj, params)

Setup HOVER camera model with the distance and hover angle limits defined as variations around the current values which depend on the given camera/pivot positions.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
params HoverCameraParamsRel The parameters of the HOVER camera.
Source:

hover_switch_horiz_rotation(camobj, enable)

Enable/disable horizontal rotation for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
enable boolean Enable or disable the rotation.
Source:

is_eye_camera(obj) → {boolean}

Check if the object is a camera and has the MS_EYE_CONTROLS movement style.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
The result of the checking.
Type
boolean
Source:

is_hover_camera(obj) → {boolean}

Check if the object is a camera and has the MS_HOVER_CONTROLS movement style.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
The result of the checking.
Type
boolean
Source:

is_look_up(camobj) → {boolean}

Check whether the camera is looking upwards.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

is_ortho_camera(camobj) → {boolean}

Check whether the camera is an ORTHO camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
boolean
Source:

is_static_camera(obj) → {boolean}

Check if the object is a camera and has the MS_STATIC movement style.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
The result of the checking.
Type
boolean
Source:

is_target_camera(obj) → {boolean}

Check if the object is a camera and has the MS_TARGET_CONTROLS movement style.
Parameters:
Name Type Description
obj Object3D Object 3D
Returns:
The result of the checking.
Type
boolean
Source:

project_point(camobj, point, destopt) → {Vec2|Vec3}

Project the 3D point to the Canvas. Returned coordinates are measured in CSS pixels.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
point Vec3 Point in world space.
dest Vec2 | Vec3 <optional>
new Float32Array(2); Destination canvas coordinates (vec2 - X/Y, vec3 - X/Y/DEPTH).
Returns:
Destination canvas coordinates.
Type
Vec2 | Vec3
Source:

rotate_camera(camobj, phi, theta, is_absopt)

Rotate the TARGET/EYE/HOVER camera counterclockwise (CCW) by the given angles depending on the camera's movement style. Performs the delta rotation or sets the camera's absolute rotation depending on the "*_is_abs" parameters.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi number Azimuth angle in radians
theta number Elevation angle in radians
is_abs boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
Source:
See:

set_eye_distance(camobj, eye_dist)

Set the distance between eyes of the stereoscopic camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
eye_dist number Distance between eyes.
Source:

set_fov(camobj, fov)

Set the vertical angle of the camera's field of view.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
fov number New camera field of view (in radians).
Source:

set_hmd_fov(camobj, hmd_left_fov, hmd_right_fov)

Set the angles of the camera's field of view (for head-mounted display only).
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
hmd_left_fov Vec4 New left camera field of view.
hmd_right_fov Vec4 New right camera field of view.
Deprecated
  • Do not use it anymore
Source:

set_ortho_scale(camobj, ortho_scale)

Set the orthogonal scale of the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
ortho_scale number Orthogonal scale.
Source:

set_projection(camobj, matrix)

Set camera projection matrix.
Parameters:
Name Type Description
camobj Object3D Camera object.
matrix Float32Array Projection matrix.
Source:

set_stereo_distance(camobj, conv_dist)

Set the distance to the convergence plane of the stereoscopic camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
conv_dist number Distance from the convergence plane.
Source:

set_translation(camobj, trans)

Translates the STATIC/EYE camera. Performs parallel translation for the TARGET/HOVER camera and its pivot.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
trans Vec3 New camera position.
Source:

set_velocities(camobj, velocity)

Set velocity parameters for the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
velocity VelocityParams Velocity parameters.
Source:

set_vertical_axis(camobj, axis)

Set vertical axis of the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
axis Vec3 Vertical axis.
Source:

static_get_rotation(camobj, destopt, nullable) → (nullable) {Quat}

Get the STATIC camera's rotation quaternion.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Quat <optional>
<nullable>
new Float32Array(4); Destination vector.
Returns:
Destination vector.
Type
Quat
Source:

static_set_look_at(camobj, posopt, nullable, look_atopt, nullable)

Set position and orientation for the STATIC camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
pos Vec3 <optional>
<nullable>
null Position of the camera. Pass null to keep the current camera position.
look_at Vec3 <optional>
<nullable>
null Point the camera is looking at. Pass null to keep the existing camera orientation.
Source:

static_set_rotation(camobj, quat)

Set the STATIC camera's rotation from quaternion.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
quat Quat Quaternion vector.
Source:

static_setup(camobj, paramsopt, nullable)

Setup the STATIC camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
params StaticCameraParams <optional>
<nullable>
null The parameters of the STATIC camera.
Source:

target_get_distance(camobj) → {number}

Get distance to the pivot point for the TARGET camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
Distance to the pivot point.
Type
number
Source:

target_get_distance_limits(camobj, destopt, nullable) → (nullable) {DistanceLimits}

Get distance limits of the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest DistanceLimits <optional>
<nullable>
new Object(); The receiving object.
Returns:
Distance limits or null if disabled.
Type
DistanceLimits
Source:

target_get_horizontal_limits(camobj, destopt, nullable, localopt) → (nullable) {HorizontalRotationLimits}

Get horizontal rotation limits of the TARGET camera (converted to the [0, 2Pi] range).
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest HorizontalRotationLimits <optional>
<nullable>
new Object(); The receiving object.
local boolean <optional>
false Use camera local space representation.
Returns:
Horizontal rotation limits or null if disabled.
Type
HorizontalRotationLimits
Source:
See:

target_get_pivot(camobj, destopt, nullable) → (nullable) {Vec3}

Get the pivot point of the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec3 <optional>
<nullable>
new Float32Array(3); Pivot destination vector.
Returns:
Pivot destination vector.
Type
Vec3
Source:

target_get_pivot_limits(camobj, destopt, nullable) → (nullable) {PivotLimits}

Get pivot limits of the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest PivotLimits <optional>
<nullable>
new Object(); The receiving object.
Returns:
pivot limits or null if disabled.
Type
PivotLimits
Source:

target_get_vertical_limits(camobj, destopt, nullable, localopt) → (nullable) {VerticalRotationLimits}

Get vertical rotation limits of the TARGET camera (converted to the [-Pi, Pi] range).
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest VerticalRotationLimits <optional>
<nullable>
new Object(); The receiving object.
local boolean <optional>
false Use camera local space representation.
Returns:
Vertical rotation limits or null if disabled.
Type
VerticalRotationLimits
Source:
See:

target_pan_pivot(camobj, trans_h_delta, trans_v_delta)

Translate the pivot point of the TARGET camera in screen space. Translation distance is defined with absolute value of parameters. +h from left to right +v from down to up
Parameters:
Name Type Description
camobj Object3D Camera 3D-object
trans_h_delta number Absolute delta of the horizontal translation.
trans_v_delta number Absolute delta of the vertical translation.
Source:

target_rotate(camobj, phi, theta, is_absopt)

Rotate the TARGET camera counterclockwise (CCW) around its pivot by the given angles. Performs delta rotation or sets the camera's absolute rotation depending on the "is_abs" parameter.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi number Azimuth angle in radians.
theta number Elevation angle in radians.
is_abs boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
Deprecated since 17.06:
Source:
See:

target_set_distance(camobj, distance)

Set distance to the pivot point for the TARGET camera. The result of this operation can be corrected by existing limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
distance number Distance to the pivot point.
Source:

target_set_distance_limits(camobj, limitsopt, nullable)

Set distance limits for the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
limits DistanceLimits <optional>
<nullable>
null Distance limits. Pass null to disable the limits.
Source:

target_set_horizontal_limits(camobj, limitsopt, nullable)

Set horizontal rotation limits for the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
limits HorizontalRotationLimits <optional>
<nullable>
null Horizontal rotation limits. Pass null to disable the limits.
Source:
See:

target_set_pivot_limits(camobj, limitsopt, nullable)

Set pivot limits for the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
limits PivotLimits <optional>
<nullable>
null Pivot limits. Pass null to disable the limits.
Source:

target_set_pivot_translation(camobj, trans)

Performs parallel translation for the TARGET camera. It works as similar as the set_translation() method but uses the camera pivot to perform the translation.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
trans Vec3 New pivot position.
Source:

target_set_trans_pivot(camobj, transopt, nullable, pivotopt, nullable)

Set translation and pivot point for the TARGET camera. The result of this operation can be corrected by existing limits.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
trans Vec3 <optional>
<nullable>
null Translation vector. Pass null to keep the current camera position.
pivot Vec3 <optional>
<nullable>
null Pivot vector. Pass null to keep the current pivot point.
Source:

target_set_vertical_limits(camobj, limitsopt, nullable)

Set vertical rotation limits for the TARGET camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
limits VerticalRotationLimits <optional>
<nullable>
null Vertical rotation limits. Pass null to disable the limits.
Source:
See:

target_setup(camobj, params)

Setup the TARGET camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
params TargetCameraParams The parameters of the TARGET camera.
Source:

target_switch_panning(camobj, enable)

Enable/disable panning for the TARGET camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
enable boolean Enable or disable panning.
Source:

target_zoom_object(camobj, obj)

Zoom the TARGET camera to the object.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
obj Object3D Object 3D.
Source:

translate_view(camobj, x, y, angle)

Translate the view plane of the camera. Modify the projection matrix of the camera so it appears to be moving in up-down and left-right directions. This method can be used to imitate character walking/running/driving.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
x number X coord (positive - left to right).
y number Y coord (positive - down to up).
angle number Rotation angle in radians (clockwise).
Source:

Type Definitions

DistanceLimits

An object that defines distance limits for the HOVER/TARGET camera. The "min" value must be less or equal than the "max" value.
Type:
  • Object
Properties:
Name Type Description
min number The minimum distance to the pivot.
max number The maximum distance to the pivot.
Source:

EyeCameraParams

An object that defines the EYE camera parameters.
Type:
  • Object
Properties:
Name Type Attributes Default Description
pos Vec3 <optional>
<nullable>
null Position of the camera. Set to null to keep the current camera position.
look_at Vec3 <optional>
<nullable>
null Point the camera is looking at. Set to null to keep the existing camera orientation.
horiz_rot_lim HorizontalRotationLimits <optional>
<nullable>
null Horizontal rotation limits. Set to null to disable the limits.
vert_rot_lim VerticalRotationLimits <optional>
<nullable>
null Vertical rotation limits. Set to null to disable the limits.
Source:

FrustumPlanes

Camera frustum planes object.
Type:
  • Object
Properties:
Name Type Description
Left Plane frustum plane.
Right Plane frustum plane.
Top Plane frustum plane.
Bottom Plane frustum plane.
Near Plane frustum plane.
Far Plane frustum plane.
Source:

HorizontalRotationLimits

An object that defines limits for rotations in a horizontal plane for the TARGET/EYE camera. The limits are converted by engine into the range [0, 2Pi] when set via API.
Type:
  • Object
Properties:
Name Type Attributes Default Description
left number The azimuth angle in radians that restricts a leftward rotation.
right number The azimuth angle in radians that restricts a rightward rotation.
camera_space boolean <optional>
false Define limits relative to the current camera position/orientation, otherwise - in world space (by default).
Source:
See:

HorizontalTranslationLimits

An object that defines limits for translations along the X axis for the HOVER camera. The "min" value must be less or equal than the "max" value.
Type:
  • Object
Properties:
Name Type Description
min number The minimum value that restricts camera translation along the X axis.
max number The maximum value that restricts camera translation along the X axis.
Source:
See:

HoverAngleLimits

An object that defines limits for rotations in a vertical plane for the HOVER camera. The limits are converted by engine into the range [-Pi, Pi] and then clamped to be in range [-Pi/2, 0] when set via API. The "down" value must be greater or equal than the "up" value.
Type:
  • Object
Properties:
Name Type Description
down number The elevation angle in radians that restricts a downward rotation.
up number The elevation angle in radians that restricts an upward rotation.
Source:
See:

HoverCameraParams

An object that defines the HOVER camera parameters.
Type:
  • Object
Properties:
Name Type Attributes Default Description
pos Vec3 <optional>
<nullable>
null Position of the camera. Set to null to keep the current camera position.
pivot Vec3 Camera pivot point.
dist_lim DistanceLimits <optional>
<nullable>
null Distance limits. Set to null to define the limits as fixed distance to the pivot which depends on the given pivot and camera positions.
hover_angle_lim HoverAngleLimits <optional>
<nullable>
null Hover angle limits. Set to null to define the limits as fixed angle which depends on the given pivot and camera positions.
horiz_trans_lim HorizontalTranslationLimits <optional>
<nullable>
null Horizontal translation limits. Set to null to disable the limits.
vert_trans_lim VerticalTranslationLimits <optional>
<nullable>
null Vertical translation limits. Set to null to disable the limits.
enable_horiz_rot boolean <optional>
false Enable horizontal rotation.
Source:

HoverCameraParamsRel

An object that defines the HOVER camera parameters.
Type:
  • Object
Properties:
Name Type Attributes Default Description
pos Vec3 <optional>
<nullable>
null Position of the camera. Set to null to keep the current camera position.
pivot Vec3 Camera pivot point.
dist_interval number <optional>
0 A distance variation around the established distance to the pivot: distance ± dist_interval/2. The resulted distance limits are clamped to be in range [0, +∞].
angle_interval number <optional>
0 A hover angle variation (in radians) around the established hover angle: hover angle ± angle_interval/2. The resulted hover angle limits are clamped to be in range [-PI/2, 0].
t number <optional>
0.5 An optional parameter which lies in range [0, 1] and defines the disposition of the given angle and distance intervals around the established values, for example: 0 - the given camera position is the nearest zoomed-in point, 1 - the given camera position is the farthest zoomed-out point, 0.5 (by default) - the given camera position is in the middle of the given intervals and can be zoomed equally in both directions.
Source:

PivotLimits

An object that defines limits for translations along the Y axis for the camera pivot point.
Type:
  • Object
Properties:
Name Type Description
min_z number The minimum value that restricts pivot translation along the Z axis.
max_z number The maximum value that restricts pivot translation along the Z axis.
Source:

StaticCameraParams

An object that defines the STATIC camera parameters.
Type:
  • Object
Properties:
Name Type Attributes Default Description
pos Vec3 <optional>
<nullable>
null Position of the camera. Set to null to keep the current camera position.
look_at Vec3 <optional>
<nullable>
null Point the camera is looking at. Set to null to keep the existing camera orientation.
Source:

TargetCameraParams

An object that defines the TARGET camera parameters.
Type:
  • Object
Properties:
Name Type Attributes Default Description
pos Vec3 <optional>
<nullable>
null Position of the camera. Set to null to keep the current camera position.
pivot Vec3 <optional>
null Camera pivot point. If set to null, when the current view vector of unit length will be used to define the pivot point.
horiz_rot_lim HorizontalRotationLimits <optional>
<nullable>
null Horizontal rotation limits. Set to null to disable the limits.
vert_rot_lim VerticalRotationLimits <optional>
<nullable>
null Vertical rotation limits. Set to null to disable the limits.
dist_lim DistanceLimits <optional>
<nullable>
null Distance limits. Set to null to disable the limits.
pivot_lim PivotLimits <optional>
<nullable>
null Pivot limits. Set to null to disable the limits.
use_panning boolean <optional>
false Use panning mode.
Source:

VelocityParams

An object that defines velocity of the camera movement.
Type:
  • Object
Properties:
Name Type Attributes Default Description
trans number <optional>
Current velocity value Translation velocity ([0,Infinity]).
rot number <optional>
Current velocity value Rotation velocity ([0,Infinity]).
zoom number <optional>
Current velocity value Zoom velocity ([0,1]).
Source:

VerticalRotationLimits

An object that defines limits for rotations in a vertical plane for the TARGET/EYE camera. The limits are converted by engine into the range [-Pi, Pi] when set via API.
Type:
  • Object
Properties:
Name Type Attributes Default Description
down number The elevation angle in radians that restricts a downward rotation.
up number The elevation angle in radians that restricts an upward rotation.
camera_space boolean <optional>
false Define limits relative to the current camera position/orientation, otherwise - in world space (by default).
Source:
See:

VerticalTranslationLimits

An object that defines limits for translations along the Z axis for the HOVER camera. The "min" value must be less or equal than the "max" value.
Type:
  • Object
Properties:
Name Type Description
min number The minimum value that restricts camera translation along the Z axis.
max number The maximum value that restricts camera translation along the Z axis.
Source:
See: