Skip to content
Follow Group Icon

Group Follow

Allows for multiple nodes to be followed and affect the PCam's positional behaviour. It works by setting a Rect2 (2D) or AABB (3D) bounding box around the targets where the PCam will track the centre of it.

An Auto Zoom (2D) and Auto Distance (3D) parameter can be applied to dynamically make the PCam readjust itself to keep multiple targets within view if they start to spread out.

This mode can be useful for single stage experiences that relies on having multiple targets in view at all times.

Video Examples

Properties

Group Targets

Type: Array[Node2D]

Default: null

Defines the nodes that the PCam should be following.

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void append_follow_group_node(Node2D target_node)

void append_follow_group_node_array(Array[Node2D] target_nodes)

void erase_follow_group_node(Node2D target_node)

Example
gdscript
# Appends one node to the Follow Group
pcam.append_follow_group_node(player_node)
# Appends an array of nodes to the Follow Group
pcam.append_follow_group_node_array(node_array)
# Removes a node from the Follow Group
pcam.erase_follow_group_node(another_node)
Example
gdscript
# Appends one node to the Follow Group
pcam.append_follow_group_node(player_node)
# Appends an array of nodes to the Follow Group
pcam.append_follow_group_node_array(node_array)
# Removes a node from the Follow Group
pcam.erase_follow_group_node(another_node)

Getter

Array[Node2D] get_follow_group_nodes()

Array[Node3D] get_follow_group_nodes()

Example
gdscript
pcam.get_follow_group_nodes()
Example
gdscript
pcam.get_follow_group_nodes()

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.

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_follow_has_damping(bool value)

Example
gdscript
pcam.set_follow_has_damping(true)

Getter

bool get_follow_has_damping()

Example
gdscript
pcam.get_follow_has_damping()

Damping Value

Type: float

Default: 10

Defines the damping amount.

Lower value = slower / heavier camera movement.

Higher value = faster / sharper camera movement.

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_follow_damping_value(float damping_value)

Example
gdscript
pcam.set_follow_damping_value(5)

Getter

float get_follow_damping_value()

Example
gdscript
pcam.get_follow_damping_value()

Auto Zoom (2D)

Type: bool

Default: false

Enables the PCam2D to dynamically zoom in and out based on the targets' distances between each other.

Once enabled, the PCam will stay as zoomed in as possible, limited by the Maximum Zoom and start zooming out as the targets move further apart, limited by the Minimum Zoom.

Note: Enabling this property hides and disables the Zoom property as this effectively overrides that value.

Phantom Camera 2D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_auto_zoom (bool should_auto_zoom)

Example
gdscript
pcam.set_auto_zoom(true)

Getter

bool get_auto_zoom()

Example
gdscript
pcam.get_auto_zoom()

Min Auto Zoom (2D)

Type: float

Default: 1

Sets the minimum zoom amount, in other words how far away the Camera2D can be from scene.

This only works when Auto Zoom is enabled.

Phantom Camera 2D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_min_auto_zoom (float min_zoom)

Example
gdscript
pcam.set_min_auto_zoom(0.42)

Getter

float get_min_auto_zoom()

Example
gdscript
pcam.get_min_auto_zoom()

Max Auto Zoom (2D)

Type: float

Default: 5

Sets the maximum zoom amount, in other words how close the Camera2D can move towards the scene.

This only works when Auto Zoom is enabled.

Phantom Camera 2D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_max_auto_zoom (float min_zoom)

Example
gdscript
pcam.set_max_auto_zoom(4)

Getter

float get_max_auto_zoom()

Example
gdscript
pcam.get_max_auto_zoom()

Auto Zoom Margin (2D)

Type: Vector4

Default: Vector4(0,0,0,0)

Determines how close to the edges the targets are allowed to be.
This is useful to avoid targets being cut off at the edges of the screen.

The Vector4 parameter order goes: Left - Top - Right - Bottom.

Phantom Camera 2D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_zoom_auto_margin (Vector4 zoom_margin)

Example
gdscript
pcam.set_zoom_auto_margin(Vector4(10, 30, 10, 40))

Getter

float get_zoom_auto_margin()

Example
gdscript
pcam.get_zoom_auto_margin()

Distance (3D)

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 is can be found in the Zoom section.

Note: During runtime, properties should be modified and read via their setters & getters respectively.


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()

Auto Distance (3D)

Type: bool

Default: false

Enables the PCam to automatically distance itself based on the targets' distances between each other.

It looks at the longest axis between the different targets and interpolates the distance length between the Minimum Distance and Maximum Distance properties below.

Note: Enabling this property hides and disables the Distance property as this effectively overrides that value.

Phantom Camera 3D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_auto_follow_distance(bool should_auto_distance)

Example
gdscript
pcam.set_auto_follow_distance(true)

Getter

bool get_auto_follow_distance()

Example
gdscript
pcam.get_auto_follow_distance()

Min Auto Distance (3D)

Type: float

Default: 1

Sets the minimum distance between the Camera and centre of AABB.

Note: This distance will only ever be reached when all the targets are in the exact same Vector3 coordinate, which will very unlikely happen, so adjust the value here accordingly.

Phantom Camera 3D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_min_auto_follow_distance(float min_distance)

Example
gdscript
pcam.set_min_auto_follow_distance(4.2)

Getter

float get_min_auto_follow_distance()

Example
gdscript
pcam.get_min_auto_follow_distance()

Max Auto Distance (3D)

Type: float

Default: 5

Sets the maximum distance between the Camera and centre of AABB.

Phantom Camera 3D

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

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_max_auto_follow_distance(float max_distance)

Example
gdscript
pcam.set_max_auto_follow_distance(4.2)

Getter

float get_max_auto_follow_distance()

Example
gdscript
pcam.get_max_auto_follow_distance()

Auto Distance Divisor (3D)

Type: float

Default: 10

Determines how fast the Auto Distance moves between the maximum and minimum distance. The higher the value, the sooner the maximum distance is reached.

This value should be based on the sizes of the Minimum Distance and Maximum Distance.
E.g. if the value between the Minimum Distance and Maximum Distance is small, consider keeping the number low and vice versa.

Note: During runtime, properties should be modified and read via their setters & getters respectively.


Setter

void set_auto_follow_distance_divisor(float distance_divisor)

Example
gdscript
pcam.set_auto_follow_distance_divisor(4.2)

Getter

float get_auto_follow_distance_divisor()

Example
gdscript
pcam.get_auto_follow_distance_divisor()