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, Russian.

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

apply_distance_limits(camobj, min, max)

Set the distance limits for the TARGET/HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera object
min Number Minimum distance to target
max Number Maximum distance to target
Deprecated:
Source:

apply_horizontal_limits(camobj, left_value, right_value, spaceopt)

Set the horizontal angle limits for the TARGET/EYE camera, or the horizontal (X axis) translation limits for the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera object
left_value Number Horizontal left limit
right_value Number Horizontal right limit
space Space <optional>
transform.SPACE_WORLD Space to make clamping relative to (actual for the TARGET/EYE camera).
Deprecated:
Source:
See:

apply_hover_angle_limits(camobj, down_angle, up_angle)

Set the hover angle limits for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera object
down_angle Number Down hover angle limit
up_angle Number Up hover angle limit
Deprecated:
Source:
See:

apply_vertical_limits(camobj, down_value, up_value, spaceopt)

Set the vertical angle limits for the TARGET/EYE camera, or the vertical (Z axis) translation limits for the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera object
down_value Number Vertical down limit
up_value Number Vertical up limit
space Space <optional>
transform.SPACE_WORLD Space to make clamping relative to (actual for the TARGET/EYE camera)
Deprecated:
Source:
See:

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:

clear_distance_limits(camobj)

Remove the distance clamping limits from the TARGET camera.
Parameters:
Name Type Description
camobj Object3D Camera object.
Deprecated:
Source:

clear_horizontal_limits(camobj)

Remove the horizontal clamping limits from the TARGET/EYE/HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Deprecated:
Source:

clear_hover_angle_limits(camobj)

Remove the hover angle limits from the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera object.
Deprecated:
  • Yes
Source:

clear_vertical_limits(camobj)

Remove the vertical clamping limits from the TARGET/EYE/HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Deprecated:
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, phi_is_absopt, 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" parameters.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi Number Azimuth angle in radians.
theta Number Elevation angle in radians.
phi_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
theta_is_abs Boolean <optional>
false Performs delta rotation if FLASE, sets camera's absolute rotation if TRUE.
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_cam_dist_limits(camobj, distopt) → (nullable) {Vec2}

Get the distance limits of the TARGET/HOVER camera.
Parameters:
Name Type Attributes Description
camobj Object3D Camera object
dist Vec2 <optional>
Array of distance limits [distance_max, distance_min].
Returns:
Array of distance limits [distance_max, distance_min].
Type
Vec2
Deprecated:
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: [phi, theta], phi: [0, 2Pi], theta: [-Pi, Pi].
Returns:
Destination vector for the camera angles: [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: [phi, theta], phi: [0, 2Pi], theta: [-Pi, Pi].
Returns:
Destination vector for the camera angles: [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: [phi, theta], phi: [0, 2Pi], theta: [-Pi, Pi].
Returns:
Destination vector for the camera angles: [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(camobj, destopt) → (nullable) {Vec3}

Get the eye point (position) of the camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera object
dest Vec3 <optional>
vec3.create() Destination eye vector.
Returns:
Destination eye vector.
Type
Vec3
Deprecated:
Source:

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_horizontal_limits(camobj, destopt) → (nullable) {Vec2}

Get the horizontal angle limits of the TARGET/EYE camera (converted to the [0, 2Pi] range), or the horizontal translation limits of the HOVER camera.
Parameters:
Name Type Attributes Description
camobj Object3D Camera Object 3D
dest Vec2 <optional>
Destination vector for the camera limits: [left, right] rotation or [Min, Max] translation limits.
Returns:
Destination vector for the camera limits: [left, right] rotation or [Min, Max] translation limits.
Type
Vec2
Deprecated:
Source:
See:

get_hover_angle_limits(camobj, anglesopt) → (nullable) {Vec2}

Get the hover angle limits for the HOVER camera, converted to the [-Pi, 0] range.
Parameters:
Name Type Attributes Description
camobj Object3D Camera object
angles Vec2 <optional>
Destination vector [hover_angle_limits.down, hover_angle_limits.up].
Returns:
Destination vector [hover_angle_limits.down, hover_angle_limits.up].
Type
Vec2
Deprecated:
Source:
See:

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

Get the pivot translation of the HOVER camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera object
dest Vec3 <optional>
vec3.create() Destination translation pivot vector.
Returns:
Destination translation pivot vector.
Type
Vec3
Deprecated:
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_pivot(camobj, destopt) → (nullable) {Vec3}

Get the pivot point of the camera.
Parameters:
Name Type Attributes Description
camobj Object3D Camera object
dest Vec3 <optional>
Destination pivot vector.
Returns:
Destination pivot vector.
Type
Vec3
Deprecated:
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_velocity_params(camobj, destopt) → (nullable) {Vec3}

Get the velocity parameters of the camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
dest Vec3 <optional>
vec3.create() Velocity params [velocity_trans, velocity_rot, velocity_zoom].
Returns:
Velocity params [velocity_trans, velocity_rot, velocity_zoom].
Type
Vec3
Deprecated:
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_vertical_limits(camobj, destopt) → (nullable) {Vec2}

Get the vertical angle limits of the TARGET/EYE camera (converted to the [-Pi, Pi] range), or the vertical translation limits of the HOVER camera.
Parameters:
Name Type Attributes Description
camobj Object3D Camera Object 3D
dest Vec2 <optional>
Destination vector for the camera limits: [down, up] rotation or [Min, Max] translation limits.
Returns:
Destination vector for the camera limits: [down, up] rotation or [Min, Max] translation limits.
Type
Vec2
Deprecated:
Source:
See:

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_limits(camobj) → {Boolean}

Check whether the EYE/TARGET camera has any horizontal limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
Boolean
Deprecated:
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_limits(camobj) → {Boolean}

Check whether the EYE/TARGET camera has any vertical limits.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
Returns:
The result of the checking.
Type
Boolean
Deprecated:
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_cam_set_translation(camobj, trans)

Set translation for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera object
trans Vec3 Translation vector.
Deprecated:
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, phi_is_absopt, 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" parameters.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi Number Azimuth angle in radians
theta Number Elevation angle in radians
phi_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
theta_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
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:

move_pivot(camobj, trans_h_delta, trans_v_delta)

Translate the pivot point of the TARGET camera in screen space. Translation distance is defined with distance factor between origin and pivot points. +h from left to right +v from down to up
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
trans_h_delta Number Delta of the horizontal translation.
trans_v_delta Number Delta of the vertical translation.
Deprecated:
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, phi_is_absopt, 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
phi_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
theta_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
Source:
See:

rotate_eye_camera(camobj, phi, theta, phi_is_absopt, theta_is_absopt)

Rotate the EYE camera counterclockwise (CCW) around its origin by the given angles. 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 object
phi Number Azimuth angle in radians
theta Number Elevation angle in radians
phi_is_abs Boolean <optional>
false For phi angle: if FALSE performs delta rotation, if TRUE sets camera absolute rotation
theta_is_abs Boolean <optional>
false For theta angle: if FALSE performs delta rotation, if TRUE sets camera absolute rotation
Deprecated:
Source:
See:

rotate_hover_camera(camobj, phi, theta, phi_is_absopt, theta_is_absopt)

Rotate the HOVER camera around its pivot by the given angles. 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 object
phi Number Azimuth angle in radians
theta Number Elevation angle in radians
phi_is_abs Boolean <optional>
false For phi angle: if FALSE performs delta rotation, if TRUE sets camera absolute rotation
theta_is_abs Boolean <optional>
false For theta angle: if FALSE performs delta rotation, if TRUE sets camera absolute rotation
Deprecated:
Source:
See:

rotate_target_camera(camobj, phi, theta, phi_is_absopt, theta_is_absopt)

Rotate the TARGET camera counterclockwise (CCW) around its pivot by the given angles. 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 object
phi Number Azimuth angle in radians
theta Number Elevation angle in radians
phi_is_abs Boolean <optional>
false For phi angle: if FALSE performs delta rotation, if TRUE sets camera absolute rotation
theta_is_abs Boolean <optional>
false For theta angle: if FALSE performs delta rotation, if TRUE sets camera absolute rotation
Deprecated:
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.
Source:

set_hover_pivot(camobj, coords)

Set the pivot point for the HOVER camera.
Parameters:
Name Type Description
camobj Object3D Camera object
coords Vec3 Pivot vector.
Deprecated:
Source:

set_look_at(camobj, eye, target, upopt)

Low-level method to set position of the STATIC/EYE camera.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera object
eye Vec3 Eye point (position of the camera)
target Vec3 Target point (point the camera is looking at)
up Vec3 <optional>
util.AXIS_Z Up vector ("up" direction of the camera)
Deprecated:
Source:

set_move_style(camobj, move_style) → {Boolean}

Set movement style (MS_*) for the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
move_style CameraMoveStyle Camera movement style
Returns:
Operation success flag.
Type
Boolean
Deprecated:
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_pivot(camobj, coords)

Set the pivot point for the TARGET camera.
Parameters:
Name Type Description
camobj Object3D Camera object
coords Vec3 New pivot vector.
Deprecated:
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_trans_pivot(camobj, trans, pivot)

Set the translation and the pivot point for the TARGET camera.
Parameters:
Name Type Description
camobj Object3D Camera Object 3D
trans Vec3 Translation vector
pivot Vec3 Pivot vector
Deprecated:
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_velocity_params(camobj, velocity)

Set the velocity parameters for the camera.
Parameters:
Name Type Description
camobj Object3D Camera 3D-object.
velocity Vec3 Camera velocity params (velocity_trans, velocity_rot, velocity_zoom)
Deprecated:
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, phi_is_absopt, 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" parameters.
Parameters:
Name Type Attributes Default Description
camobj Object3D Camera 3D-object.
phi Number Azimuth angle in radians.
theta Number Elevation angle in radians.
phi_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
theta_is_abs Boolean <optional>
false Performs delta rotation if FALSE, sets camera's absolute rotation if TRUE.
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 (clockwise).
Source:

zoom_object(camobj, obj)

Zoom the camera to the object.
Parameters:
Name Type Description
camobj Object3D Camera object
obj Object3D Object 3D
Deprecated:
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 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 Camera 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: