Skip to content

TopdownFreeLogic ​

Inherits: CameraLogic < Resource

Top-down camera with WASD movement and target following This resource IS the runtime logic - no separate instance needed Save to: res://src/data/controller_logic/camera/ Input arrives from the InputManager (uses_input_manager() == true). WASD pans the camera only when the controller does not move the player with WASD; with a WASD controller the camera simply follows the player.

Properties ​

floatcamera_move_speed20.0
floatzoom_speed_damp0.8
floatcamera_x_at_min10.0
floatcamera_x_at_max-20.0
floatsocket_x_at_min-35.0
floatsocket_x_at_max-75.0
floatpan_teleport_distance90.0
Vector3pan_teleport_offsetVector3(0, 0, 9)
boolenable_nameplate_scalingtrue
floatnameplate_scale_min0.6
floatnameplate_scale_max1.2

Variables ​

Node3Dfollow_target
boolfollow_cam_ontrue
Vector3current_velocityVector3.ZERO
floatcamera_zoom_direction0
floatcamera_x_rotation0.0
Vector3pan_target_positionVector3.ZERO
boolis_panning_to_positionfalse

Methods ​

voidsetup( cm: CameraController )
voidprocess_camera( delta: float )
booluses_input_manager()
Array[LookBinding]get_look_bindings()
voidhandle_look( kind: LookBinding.Kind, delta_rad: Vector2 )
voidhandle_zoom( steps: int )
voidset_target( target: Variant, use_pan: bool = true )
Stringget_type_display_name()
Array[String]validate()

Constants ​

  • float VIEW_ROTATE_FEEL = 0.5 - View rotation relative to free look at the same mouse setting. Top-down rotation was always half the speed of a free orbit (0.1 vs 0.2 degrees per pixel at the default setting).

Property descriptions ​

Topdown Movement

float camera_move_speed = 20.0 ​

WASD keyboard movement speed

Zoom Behavior

float zoom_speed_damp = 0.8 ​

Zoom speed damping

Dynamic Camera Angles

float camera_x_at_min = 10.0 ​

Camera X rotation at min zoom

float camera_x_at_max = -20.0 ​

Camera X rotation at max zoom

Socket Rotation

float socket_x_at_min = -35.0 ​

The tilt of the camera socket at the closest zoom, in degrees.

float socket_x_at_max = -75.0 ​

The tilt of the camera socket at the farthest zoom, in degrees.

Pan Behavior

float pan_teleport_distance = 90.0 ​

Farther than this, the camera jumps to the target instead of gliding.

Vector3 pan_teleport_offset = Vector3(0, 0, 9) ​

Where the camera lands when it jumps to the target, from the target.

UI Scaling

bool enable_nameplate_scaling = true ​

True when the nameplates change size with the zoom.

float nameplate_scale_min = 0.6 ​

The size of the nameplates at the closest zoom.

float nameplate_scale_max = 1.2 ​

The size of the nameplates at the farthest zoom.

Variable descriptions ​

Node3D follow_target ​

Runtime state (not exported)

bool follow_cam_on = true ​

True while the camera follows the target.

Vector3 current_velocity = Vector3.ZERO ​

The speed of the camera now.

float camera_zoom_direction = 0 ​

The direction the zoom moves in now.

float camera_x_rotation = 0.0 ​

The tilt of the camera now, in degrees.

Vector3 pan_target_position = Vector3.ZERO ​

The position the camera glides to.

bool is_panning_to_position = false ​

True while the camera glides to a position.

Method descriptions ​

void setup( cm: CameraController ) ​

Sets the logic up when it becomes the one in use.

void process_camera( delta: float ) ​

Moves the camera one frame.

bool uses_input_manager() ​

Does the logic get its look input from the input manager?

Array[LookBinding] get_look_bindings() ​

The mouse buttons that turn the view or the character for this logic.

void handle_look( kind: LookBinding.Kind, delta_rad: Vector2 ) ​

Turns the view or the character by the mouse movement.

void handle_zoom( steps: int ) ​

Zooms by the steps of the mouse wheel (positive steps zoom in).

void set_target( target: Variant, use_pan: bool = true ) ​

Sets what the camera follows. With pan on, it glides there.

String get_type_display_name() ​

The name of the logic in the editor.

Array[String] validate() ​

Checks the settings. Gives the problems found (empty when it is fine).