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
# 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)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.
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
pcam.set_follow_damping_value(5)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.
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.
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.
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.
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.
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.
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.
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
pcam.set_zoom_auto_margin(Vector4(10, 30, 10, 40))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.
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.
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.
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
pcam.set_auto_follow_distance(true)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.
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
pcam.set_min_auto_follow_distance(4.2)Max Auto Distance (3D)
Type: float
Default: 5
Sets the maximum distance between the Camera and centre of AABB.
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
pcam.set_max_auto_follow_distance(4.2)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
pcam.set_auto_follow_distance_divisor(4.2)Getter
float get_auto_follow_distance_divisor()
Example
pcam.get_auto_follow_distance_divisor()