Skip to content
Follow Framed Icon

Framed Follow ​

Enables dynamic framing of a given target using horizontal and vertical dead zones. The dead zones enable the PCam to remain still until the target moves beyond them where the PCam will then resume following.

Previewing the Dead Zone can be done from the Viewfinder panel, which can be found at the bottom of the editor.

Alternatively, enable the show_viewfinder_in_play property in the inspector to show the dead zone while running the game from the editor.

Video Examples ​

Interactive Dead Zone Dragging

Dead Zone, the green lines, can be manually dragged and adjusted in both the viewfinder and at runtime in the scene itself. The only requirement is that the active PCam is editable in the scene that is active / running.

If a PCam is located within a instantiated scene, then that scene needs to have Editable Children (right-click and toggle it from the dropdown menu) enabled first - much like editing instantiated nodes in general.

Properties ​

follow_target ​

Type: Node2D

Default: null

Determines which Node should be followed. The Camera will follow the position of the Follow Target based on the Follow Mode type and its parameters.


Setter ​

void set_follow_target(Node2D target_node)

Example
gdscript
pcam.set_follow_target(player_node)
Example
gdscript
pcam.set_follow_target(player_node)

Getter ​

Node2D get_follow_target_node()

Node3D get_follow_target_node()

Example
gdscript
pcam.get_follow_target_node()
Example
gdscript
pcam.get_follow_target_node()

follow_offset ​

Type: Vector2

Default: Vector2(0,0)

Offsets the follow target's position.


Setter ​

void set_follow_offset(Vector2 offset)

Example
gdscript
pcam.set_follow_offset(Vector2(1, 1))
Example
gdscript
pcam.set_follow_offset(Vector3(1, 1, 1))

Getter ​

Vector2 get_follow_offset()

Vector3 get_follow_offset()

Example
gdscript
pcam.get_follow_offset()
Example
gdscript
pcam.get_follow_offset()

follow_damping ​

Type: bool

Default: false

Applies a damping effect on the Camera's movement. Leading to heavier / slower camera movement as the targeted node moves around.

This is useful to avoid sharp and rapid camera movement.


Setter ​

void set_follow_damping(bool enable)

Example
gdscript
pcam.set_follow_damping(true)

Getter ​

bool get_follow_damping()

Example
gdscript
pcam.get_follow_damping()

damping_value ​

Type: Vector2

Default: Vector2(0.1, 0.1)

Defines the damping amount. The ideal range should be somewhere between 0-1, likely somewhere around 0.1-0.25.

The damping amount is specified in the individual axis. X and Y for 2D and X, Y and Z for 3D scenes. To have the damping be consistent in all directions, simply supply the same value in all slots.

Lower value = faster / sharper camera movement.
Higher value = slower / heavier camera movement.


Setter ​

void set_follow_damping_value(Vector2 damping_value)

Example
gdscript
pcam.set_follow_damping_value(Vector2(0.2, 0.2))
Example
gdscript
pcam.set_follow_damping_value(Vector3(0.2, 0.2, 0.2))

Getter ​

Vector2 get_follow_damping_value()

Vector3 get_follow_damping_value()

Example
gdscript
pcam.get_follow_damping_value()
Example
gdscript
pcam.get_follow_damping_value()

follow_distance ​

Type: float

Default: 1

Sets a distance offset from the centre of the target. The distance is applied to the PCam's local z axis.

Phantom Camera 3D

This property is for PCam3D only.
The PCam2D alternative to this can be found in the zoom section.


Setter ​

void set_follow_distance(float distance)

Example
gdscript
pcam.set_follow_distance(4.2)

Getter ​

float get_follow_distance()

Example
gdscript
pcam.get_follow_distance()

dead_zone_width ​

Type: Vector2

Default: Vector2(0, 0)

Defines the left and right dead zone areas. While the target is within it, the PCam will not move in the horizontal axis.

If the follow target leaves the horizontal bounds, the PCam will follow the target horizontally to keep it within bounds.

X = Left Dead Zone

Y = Right Dead Zone


Setter ​

void set_dead_zone_width(Vector2 value)

Example
gdscript
pcam.set_dead_zone_width(Vector2(0.3, 0.6))

Getter ​

bool get_dead_zone_width()

Example
gdscript
pcam.get_dead_zone_width()

dead_zone_height ​

Type: Vector2

Default: Vector2(0, 0)

Defines the top and right dead zone areas. While the target is within it, the PCam will not move in the vertical axis.

If the follow target leaves the vertical bounds, the PCam will follow the target horizontally to keep it within bounds.

X = Left Dead Zone

Y = Right Dead Zone


Setter ​

void set_dead_zone_height(Vector2 value)

Example
gdscript
pcam.set_dead_zone_height(Vector2(0.1, 0.8))

Getter ​

bool get_dead_zone_height()

Example
gdscript
pcam.get_dead_zone_height()

dead_zone_depth ​

Type: Vector2

Default: Vector2(0, 0)

Defines the depth, or the local z-axis distance, dead zone area.

By default, the camera will keep a persistent distance between itself and the follow_target in the forward axis defined in the follow_distance.

Setting a value will add a dead zone where the camera will remain still if the follow_target gets further or closer to it.

X = represents the maximum z dead space, i.e. the space behind the `follow_target and target itself.

Y = represents the minimum z dead space, i.e. between the camera and the follow_target.

Phantom Camera 3D

This property is for PCam3D only.


Setter ​

void set_dead_zone_depth(Vector2 value)

Example
gdscript
pcam.set_dead_zone_depth(Vector2(5, 5))

Getter ​

Vector2 get_dead_zone_depth()

Example
gdscript
pcam.get_dead_zone_depth()

center_on_active ​

Type: bool

Default: true

If true, will reset the target at the center of the viewport when the PCam becomes active and begins tweening towards it.


Setter ​

void set_center_on_active(Vector2 value)

Example
gdscript
pcam.set_center_on_active(true)

Getter ​

bool get_center_on_active()

Example
gdscript
pcam.get_center_on_active()

show_viewfinder_in_play ​

Type: bool

Default: false

Enables the dead zones to be visible when running the game from the editor.

Dead zones will always be disabled in build exports.

Note: This property is only accessible within the node's inspector panel in the editor.

interactive_dead_zone ​

Type: int

Default: 0

Defines where the dead_zone_width and dead_zone_height edges should be editable by dragging the edges of the dead zone lines.

By default, it is editable from both the editor viewfinder and at runtime.

Interactive Dead ZoneValue
ALL0
VIEWFINDER1
RUNTIME2
NONE3

Note: This property is only accessible within the node's inspector panel in the editor.

rotate_with_target ​

Type: bool

Default: false

Makes the PhantomCamera2D copy the rotation of its follow_target This behavior is only available when follow_mode is set and only has one follow_target.

Important

Be sure to disable ignore_rotation on the Camera2D node to enable this feature.

Phantom Camera 2D

This property is for PCam2D only.


Setter ​

void set_rotate_with_target(bool enable)

Example
gdscript
pcam.set_rotate_with_target(true)

Getter ​

float get_rotate_with_target()

Example
gdscript
pcam.get_rotate_with_target()

rotation_offset ​

Type: float

Default: 0

Offsets the rotation when rotate_with_target is enabled.

Phantom Camera 2D

This property is for PCam2D only.


Setter ​

void set_rotation_offset(float rotation_offset)

Example
gdscript
pcam.set_rotation_offset(42)

Getter ​

float get_rotation_offset()

Example
gdscript
pcam.get_rotation_offset()

rotation_damping ​

Type: bool

Default: false

Enables rotational damping when rotate_with_target is enabled.

Phantom Camera 2D

This property is for PCam2D only.


Setter ​

void set_rotation_damping(bool enable)

Example
gdscript
pcam.set_rotation_damping(true)

Getter ​

bool get_rotation_damping()

Example
gdscript
pcam.get_rotation_damping()

rotation_damping_value ​

Type: float

Default: 0.1

Defines the damping amount for the rotate_with_target.

Phantom Camera 2D

This property is for PCam2D only.


Setter ​

void set_rotation_damping_value(float damping_value)

Example
gdscript
pcam.set_rotation_damping_value(0.42)

Getter ​

float get_rotation_damping_value()

Example
gdscript
pcam.get_rotation_damping_value()

Made with ♥ in Vitepress