Skip to content

$camera

Read and control cameras.

27 natives. Read-only natives only look things up; the rest change something. Parameter types use the language's names (Types).

blend_spring

$camera.blend_spring(user: User, property_index: int, previous: float, weight: float) -> float

Interpolate a property's spring with a previous value at a given weight

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.
previousfloatThe spring's last value
weightfloatThe interpolation factor

Returns float: The blended value the spring was set to

blend_target_spring

$camera.blend_target_spring(user: User, previous: vec3, weight: float) -> vec3

Interpolate a target's spring with a previous value at a given weight

ParameterTypeMeaning
userUserThe camera's user.
previousvec3The spring's last value
weightfloatThe interpolation factor

Returns vec3: The blended value the spring was set to

clear_properties

$camera.clear_properties(user: User)

Reverts properties to 0 and saves off active values into last_frame.

ParameterTypeMeaning
userUserThe camera's user.

get_clamp

$camera.get_clamp(user: User, property_index: int, is_min: bool) -> float

Gets the clamp value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.
is_minboolTrue if trying to get the minimum clamp value

Returns float: The clamp value of the camera property.

get_clamped_property

$camera.get_clamped_property(user: User, property_index: int) -> float

Gets the clamped value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.

Returns float: The clamped value of a given property.

get_controller_spring_names

$camera.get_controller_spring_names(user: User) -> list

Get a list of active spring controller names

ParameterTypeMeaning
userUserThe camera's user.

Returns list: Active spring controller for each property.

get_controller_spring_values

$camera.get_controller_spring_values(user: User) -> list

Get a list of spring values

ParameterTypeMeaning
userUserThe camera's user.

Returns list: Spring values for each property.

get_controller_value_names

$camera.get_controller_value_names(user: User) -> list

Get a list of active controller names

ParameterTypeMeaning
userUserThe camera's user.

Returns list: Active controller for each property.

get_controller_values

$camera.get_controller_values(user: User) -> list

Get a list of controller values

ParameterTypeMeaning
userUserThe camera's user.

Returns list: Controller values for each property.

get_manual_camera_enabled

read-only
$camera.get_manual_camera_enabled(index: int) -> bool

Gets the value of the manual_camera_enabled debug toggle.

ParameterTypeMeaning
indexintThe camera index. If no index is specified, it will return true if any index manual_camera_enabled is true

Returns bool: The value of manual_camera_enabled

get_name

$camera.get_name(user: User, property_index: int) -> string

Gets the name a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.

Returns string: The name of the controller for the camera property.

get_property_value

$camera.get_property_value(user: User, property_index: int) -> float

Gets the value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.

Returns float: The value of the camera property.

get_spring

$camera.get_spring(user: User, property_index: int) -> float

Gets the spring value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.

Returns float: The spring value of the camera property.

get_spring_name

$camera.get_spring_name(user: User, property_index: int) -> string

Gets the name a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.

Returns string: The name of the spring controller for the camera property.

get_target_spring

$camera.get_target_spring(user: User) -> vec3

Gets the spring value of a target property

ParameterTypeMeaning
userUserThe camera's user.

Returns vec3: The base value of the target property.

get_target_value

$camera.get_target_value(user: User) -> vec3

Gets the base value of a target property

ParameterTypeMeaning
userUserThe camera's user.

Returns vec3: The base value of the target property.

set_clamp

$camera.set_clamp(user: User, property_index: int, priority: int, value: float, is_min: bool)

Tries to set the clamp value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.
priorityintA unique priority level.
valuefloatThe value the clamp should be set to.
is_minboolTrue if trying to set the minimum clamp value

set_clip_planes_global

$camera.set_clip_planes_global(near: float, far: float)

Set the global near and far plane distances for the cameras in the level. Transient and should be called every frame in draw()

ParameterTypeMeaning
nearfloatNear plane distance
farfloatFar plane distance

set_debug_camera_fov

$camera.set_debug_camera_fov(fov: float)

Sets the debug camera fov.

ParameterTypeMeaning
fovfloatThe camera fov, between 30 and 80.

set_debug_camera_speed

$camera.set_debug_camera_speed(speed: float)

Sets the debug camera speed.

ParameterTypeMeaning
speedfloatThe camera speed.

set_manual_camera_enabled

$camera.set_manual_camera_enabled(index: int, enabled: bool, gamepad_enabled: bool)

Sets the value of the manual_camera_enabled and manual_camera_gamepad_enabled toggles.

ParameterTypeMeaning
indexintThe camera index. If no index is specified, it will use index 0.
enabledboolWhether we want to enable the debug camera at the given index.
gamepad_enabledboolWhether we want to enable gamepad controls for the debug camera at the given index.

set_property

$camera.set_property(user: User, property_index: int, priority: int, value: float)

Does a priority check and tries to set the base value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.
priorityintA unique priority level.
valuefloatThe value the property should be set to.

set_spring

$camera.set_spring(user: User, property_index: int, priority: int, value: float)

Tries to set the spring value of a given property

ParameterTypeMeaning
userUserThe camera's user.
property_indexintThe property index to update.
priorityintA unique priority level.
valuefloatThe value the spring should be set to.

set_target

$camera.set_target(user: User, priority: int, value: vec3)

Tries to set the base value of a given target

ParameterTypeMeaning
userUserThe camera's user.
priorityintA unique priority level.
valuevec3The value the target should be set to.

set_target_spring

$camera.set_target_spring(user: User, priority: int, value: vec3)

Tries to set the spring value of a given target

ParameterTypeMeaning
userUserThe camera's user.
priorityintA unique priority level.
valuevec3The value the spring should be set to.

update_projection

$camera.update_projection(mode: int, vfov: float, ortho_height: float, user: User, near: float, far: float, name: string, interpolation_id: int)

Update the camera projection matrix with the specified dimensions.

ParameterTypeMeaning
modeintProjection mode from k_camera_projection_mode*.
vfovfloatFull vertical field of view in degrees, between 0 and 180 (exclusive) for perspective cameras; ignored for others.
ortho_heightfloatHeight (positive non-zero) for ortho cameras; ignored for others.
userUserThe camera's user.
nearfloatnear plane distance of the camera. Using global settings when set to 0
farfloatfar plane distance of the camera. Using global settings when set to 0
namestring(optional) Camera name to control; if unset, default to user camera.
interpolation_idint(optional) The interpolation id. Out thread won't interpolate across different interpolation_ids. If name is null, interpolation id will be an offset based on component and will never interpolate if different components are calling this function. Should not be decreasing to avoid (1->2->1) where the frame with 2 can be skipped at out.

update_view

$camera.update_view(position: vec3, rotation: vec4, user: User, name: string, interpolation_id: int, pivot: vec3)

Update the camera matrix with the specified position and rotation.

ParameterTypeMeaning
positionvec3The camera position.
rotationvec4The camera rotation quaternion.
userUserThe camera's user.
namestring(optional) Camera name to control; if unset, default to user camera.
interpolation_idint(optional) The interpolation id. Out thread won't interpolate across different interpolation_ids. If name is null, interpolation id will be an offset based on component and will never interpolate if different components are calling this function. Should not be decreasing to avoid (1->2->1) where the frame with 2 can be skipped at out.
pivotvec3The pivot position used for interpolation. If set, camera will interpolate as "pivot+local offset+rotation" instead of "world position+rotation". This helps stabilize camera interpolation when rotating around an object.