Follow Overview
Determines the positional logic for a given PCam.
The different modes have different functionalities and purposes, so choosing the correct one depends on what each PCam is meant to do.
Core Modes
Third Person
Applies a SpringArm3D node to its target and allows for rotating around it.
Properties
follow_mode
Type: int
Default: 0
Defines the current Follow Mode of the PCam based on FOLLOW_MODE enum.
| Follow Mode | Value |
|---|---|
| NONE | 0 |
| GLUED | 1 |
| SIMPLE | 2 |
| GROUP | 3 |
| PATH | 4 |
| FRAMED | 5 |
| THIRD_PERSON | 6 |
Only Third Person Follow is exclusive to 3D scenes.
Important
This property should not be changed during runtime, as such the setter for this has purposely been excluded.
To use another follow_mode at runtime, switch to a separate PCam with the specific follow_mode applied.
follow_axis_lock
Type: int
Default: 0
Prevents camera movement in one or multiple world axes.
Locking a PCam does not change its position nor take its Follow Target's transform values into account.
Note
This only applies once the PCam has a valid Follow Target.
2D
| FollowLockAxis | Value |
|---|---|
| NONE | 0 |
| X | 1 |
| Y | 2 |
| XY | 3 |
3D
| FollowLockAxis | Value |
|---|---|
| NONE | 0 |
| X | 1 |
| Y | 2 |
| Z | 3 |
| XY | 4 |
| XZ | 5 |
| YZ | 6 |
| XYZ | 7 |
lookahead
Type: bool
Default: false
Enables velocity-based lookahead.
As the follow target moves the camera will move further ahead based on its velocity. The faster the follow target moves, the further ahead the camera will move.
This property is for PCam2D only.
lookahead_time
Type: Vector2
Default: Vector2(0.5, 0.5)
The amount of seconds to look ahead of the [param follow target]'s position per axis based on the [param follow target]'s velocity.
Each axis has its own prediction time in seconds. A value of 0 can be set either to disable lookahead for the corresponding axis.
This property is for PCam2D only.
Setter
void set_lookahead_time(Vector2 value)
Example
pcam.set_lookahead_time(Vector2(0.4, 0.2))lookahead_acceleration
Type: float
Default: 0.2
Determines the damping speed of how fast the camera should reach the lookahead_time target once the follow target has a positional velocity.
Lower value = faster.
Higher value = slower.
This property is for PCam2D only.
Setter
void set_lookahead_acceleration(float value)
Example
pcam.set_lookahead_acceleration(0.6)lookahead_deceleration
Type: float
Default: 0.2
Determines the damping speed of how fast the camera should decelerate back to the follow target's position once it has no positional velocity.
Lower value = faster.
Higher value = slower.
This property is for PCam2D only.
Setter
void set_lookahead_deceleration(float value)
Example
pcam.set_lookahead_deceleration(0.6)lookahead_max
Type: bool
Default: false
Enables a maximum velocity limit in pixels per second for the follow_lookahead effect.
If true, the follow target's velocity will be clamped to the follow_lookahead_max_value before calculating lookahead.
In other words, no matter how fast the target's actual velocity is, the lookahead will only follow up to the speed defined here.
This property is for PCam2D only.
lookahead_max_value
Type: Vector2
Default: Vector2(200, 200)
The maximum lookahead velocity in pixels per second. The follow target's velocity will be clamped within these bounds on each axis before applying lookahead time.
This property is for PCam2D only.
Methods
bool is_following
Returns true if the PCam follow_mode is not set to NONE and has a valid follow_target.
Example
pcam.is_following()