• Reference
  • LUA API
  • Classes
  • Camera

Camera

The camera is one of the basic elements within the project. The game camera is the tool that controls the player's point of view.

Functions

get_camera_by_scene_id

Get the camera by scene ID.

Parameter

VariableTypeDescription
scene_idnumberID in the edit scene.

Return

TypeDescription
cameraCamera.
cli.get_camera_by_scene_id(scene_id)

get_camera_by_scene_id

Whether the player camera is playing an animation or not.

Parameter

VariableTypeDescription
playerplayerPlayer.

Return

TypeDescription
booleanWhether the animation is playing.
camera.get_camera_by_scene_id(player)

create_camera

Create a camera.

Parameters

VariableTypeDescription
pointpointPoint where the camera is located.
focal_lengthnumberFocal length.
focal_heightnumberHeight of the focal point.
yawnumberYaw of the camera.
pitchnumberPitch of the camera.
range_of_visibilitynumberRange of the telephoto crop.

Return

TypeDescription
numberID in the edit scene.
camera.create_camera(point, focal_length, focal_height, yaw, pitch, range_of_visibility)

apply_camera

Apply the camera.

Parameters

VariableTypeDescription
playerplayerPlayer.
cameracameraCamera.
timenumberTransition time.
move_typenumberMove type enumeration.
camera.apply_camera(player, camera, time, move_type)

enable_camera_move

Allow the player camera to move.

Parameter

VariableTypeDescription
playerplayerPlayer.
camera.enable_camera_move(player)

disable_camera_move

Disable player camera movement.

Parameter

VariableTypeDescription
playerplayerPlayer.
camera.disable_camera_move(player)

play_camera_timeline

Play the camera animation.

Parameters

VariableTypeDescription
playerplayerPlayer.
camera_timeline_idnumberCamera animation ID.
camera.play_camera_timeline(player, camera_timeline_id)

stop_camera_timeline

Stop the camera animation.

Parameter

VariableTypeDescription
playerplayerPlayer.
camera.stop_camera_timeline(player)

camera_shake_with_decay

Camera shake with decay.

Parameters

VariableTypeDescription
playerplayerPlayer.
shakenumberAmplitude of vibration.
attenuationnumberAttenuation.
frequencynumberFrequency.
timenumberDuration.
shake_typenumberVibration mode.
camera.camera_shake_with_decay(player, shake, attenuation, frequency, time, shake_type)

camera_shake

Camera shake camera.

Parameters

VariableTypeDescription
playerplayerPlayer.
strengthnumberShake range.
speednumberSpeed.
timenumberDuration.
shake_typenumberShake mode.
camera.camera_shake(player, strength, speed, time, shake_type)

linear_move_by_time

Linear move (time).

Parameters

VariableTypeDescription
playerplayerPlayer.
pointpointTarget point.
timenumberTransition time.
move_typenumberMove mode.
camera.linear_move_by_time(player, point, time, move_type)

set_camera_follow_unit

Set the camera follow unit.

Parameters

VariableTypeDescription
playerplayerPlayer.
unitunitTarget unit.
xnumberTransition time.
ynumberMovement mode.
heightnumberHeight.
camera.set_camera_follow_unit(player, unit, x, y, height)

cancel_camera_follow_unit

Set the camera to cancel following.

Parameter

VariableTypeDescription
playerplayerPlayer.
camera.cancel_camera_follow_unit(player)

set_tps_follow_unit

Set the camera's third-person follow unit.

Parameters

VariableTypeDescription
playerplayerPlayer.
unitunitTarget unit.
sensitivitynumberSensitivity.
yawnumberYaw.
pitchnumberPitch.
x_offsetnumberOffset x.
y_offsetnumberOffset y.
z_offsetnumberOffset height.
camera_distancenumberDistance from focus.
camera.set_tps_follow_unit(player, unit, sensitivity, yaw, pitch, x_offset, y_offset, z_offset, camera_distance)

cancel_tps_follow_unit

Cancel the third-person follow unit of the camera.

Parameter

VariableTypeDescription
playerplayerPlayer.
camera.cancel_tps_follow_unit(player)

look_at_point

Set the camera to face the point.

Parameters

VariableTypeDescription
playerplayerPlayer.
pointpointTarget point.
timenumberTransition time.
camera.look_at_point(player, point, time)

set_max_distance

Set the maximum height of the camera.

Parameters

VariableTypeDescription
playerplayerPlayer.
valuenumberHeight limit.
camera.set_max_distance(player, value)

set_rotate

Set the camera angle.

Parameters

VariableTypeDescription
playerplayerPlayer.
angle_typenumberAngle type.
valuenumberValue.
timenumberTransition time.
camera.set_rotate(player, angle_type, value, time)

set_distance

Set the focus distance.

Parameters

VariableTypeDescription
playerplayerPlayer.
valuenumberValue.
timenumberTransition time.
camera.set_distance(player, value, time)

set_focus_height

Set the focus height of the camera.

Parameters

VariableTypeDescription
playerplayerPlayer.
valuenumberValue.
timenumberTransition time.
camera.set_focus_height(player, value, time)

limit_in_rectangle_area

Limit the camera movement area.

Parameters

VariableTypeDescription
playerplayerPlayer.
areaareaMove range area.
camera.limit_in_rectangle_area(player, area)

cancel_area_limit

Turn off camera limit movement.

Parameter

VariableTypeDescription
playerplayerPlayer.
camera.cancel_area_limit(player)

set_moving_with_mouse

Set whether the camera can be moved with the mouse.

Parameters

VariableTypeDescription
playerplayerPlayer.
statebooleanSwitch.
camera.set_moving_with_mouse(player, state)

set_mouse_move_camera_speed

Set the camera moving speed (mouse).

Parameters

VariableTypeDescription
playerplayerPlayer.
speednumberSpeed of movement.
camera.set_mouse_move_camera_speed(player, speed)

set_keyboard_move_camera_speed

Set the camera move speed (keyboard).

Parameters

VariableTypeDescription
playerplayerPlayer.
speednumberSpeed of the move.
camera.set_keyboard_move_camera_speed(player, speed)

get_player_camera_direction

Get the player camera direction.

Parameter

VariableTypeDescription
playerplayerPlayer.

Return

TypeDescription
numberCamera direction.
camera.get_player_camera_direction(player)

get_camera_center_raycast

Get the collision point of the player's camera center ray.

Parameter

VariableTypeDescription
playerplayerPlayer.

Return

TypeDescription
pointCollision point of the camera center ray.