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
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
pcam.set_follow_target(player_node)
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.
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
pcam.set_follow_damping_value(Vector2(0.2, 0.2))
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.
This property is for PCam3D
only.
The PCam2D
alternative to this can be found in the zoom section.
dead_zone_height
Type: float
Default: 0
Defines the horizontal dead zone area. While the target is within it, the PCam
will not move in the horizontal axis. If the targeted node leaves the horizontal bounds, the PCam
will follow the target horizontally to keep it within bounds.
Note: This property is only accessible within the node's inspector panel in the editor.
dead_zone_height
Type: float
Default: 0
Defines the vertical dead zone area. While the target is within it, the PCam
will not move in the vertical axis. If the targeted node leaves the vertical bounds, the PCam
will follow vertically to keep it within bounds.
Note: This property is only accessible within the node's inspector panel in the editor.
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.