PhantomCameraHost
Inherits: Node
Shortened to PCamHost (text) and pcam_host (code) manages a scene's PCam nodes and is what ultimately supplies the logic to the Camera. It decides which PCam the Camera should be attached to and, consequently, its logic.
Multiple PhantomCameraHosts
Each scene can contain an unlimited amount of PCamHosts and Camera2D/3D nodes, where multiple PCamHosts can belong to the same PCam at the same time; leading to each camera having the same Follow or Look At behavior.
Tip
In the vast majority of cases, having multiple PCamHosts is not necessary. Using more than one is mainly for use-cases where multiple cameras need to render different at the same time, such as for splitscreen co-op.
Once more than one PCamHosts is in a given scene, the Viewfinder will display a collapsible list of all the PCamHosts instances in the current scene.
See the Viewfinder page for more details.
Properties
host_layers
Type: int
Default: 1
Determines which PCam2D / PCam3D nodes this PCamHost should recognize.
At least one corresponding layer needs to be set on the PCam node for the PCamHost to recognize it.
Note: The layer value uses a bitmask.
Tip
A helper function also exists called set_host_layers_value(), where you can supply a specific layer number and then enable / disable it (see setter example below). Use this if you prefer not having to supply bitmask values.
Setter
void set_host_layers(int value)
void set_host_layers_value(int layer, bool enabled)
Example
## Bitmask assignment
pcam_host.set_host_layers(10) # Enables the 2nd and 4th layer using a bitmask value
## Specific layer change
pcam_host.set_host_layers_value(4, true) # Enables the 4th layerGetter
int get_host_layers()
Example
pcam_host.get_host_layers() # Returns the layer value as a bitmaskinterpolation_mode
Type: int
Default: 0
Determines whether the PhantomCamera2D / PhantomCamera3D nodes this PhantomCameraHost controls should use physics interpolation or not.
| InterpolationMode | Value |
|---|---|
| AUTO | 0 |
| IDLE | 1 |
| PHYSICS | 2 |
Setter
void set_interpolation_mode(int value)
Example
pcam_host.set_interpolation_mode(InterpolationMode.IDLE)Getter
int get_interpolation_mode()
Example
pcam_host.get_interpolation_mode() # Returns the current interpolation modeMethods
Node get_active_pcam
Returns the currently active PCam2D / PCam3D for this PCamHost node.
Example
pcam_host.get_active_pcam()Signals
pcam_became_active (pcam: Node)
Emitted when a new PCam becomes active and assigned to this PCamHost.
The argument is the PCam that became active.
pcam_became_inactive (pcam: Node)
Emitted when the currently active PCam goes from being active to inactive.
The argument is the PCam that became inactive.