Skip to content

PhantomCamera3D

Inherits: Node3D

PhantomCamera3D, shortened to PCam3D (text) and pcam_3d (code), is used in 3D scenes.

PCam3Ds can manually be enabled / disabled by toggling its visibility in the Scene hierarchy panel.

Core Properties

image alt

Priority

Determines which PCam3D should be controlling the Camera3D.

image alt

Follow Mode

Enables the PCam3D to follow specific target(s) using various logics.

image alt

Look At

Enables the PCam3D to look at specific node(s), effectively adjusting its rotational value.

image alt

Tween

Determines how the Camera3D should tween to this PhantomCamera3D upon becoming active.

Secondary Properties

active

Type: bool

Default: false

Returns true if this PCam is the one controlling the scene's Camera.


Getter

bool is_active()

Example
gdscript
pcam.is_active()

tween_on_load

Type: bool

Default: true

By default, the moment a PCam is instantiated into a scene, and has the highest priority, it will perform its tween transition.

This is most obvious if a PCam has a long duration and is attached to a playable character that can be moved the moment a scene is loaded.

Disabling the Tween on Load property will disable this behaviour and skip the tweening entirely when instantiated.


Setter

void set_tween_on_load(bool enable)

Example
gdscript
pcam.set_tween_on_load(false)

Getter

bool get_tween_on_load()

Example
gdscript
pcam.get_tween_on_load()

inactive_update_mode

Type: int

Default: 0

Determines how often an inactive PCam should update its positional and rotational values. This is meant to reduce the amount of calculations inactive PCams are doing when idling to improve performance. The value is based on the enum type InactiveUpdateMode.

Inactive Update ModeValue
ALWAYS0
NEVER1

Setter

void set_inactive_update_mode(int update_mode)

Example
gdscript
pcam.set_inactive_update_mode(InactiveUpdateMode.NEVER)

Getter

int get_inactive_update_mode()

Example
gdscript
pcam.get_inactive_update_mode()

tween_resource

Type: PhantomCameraTween

Default: null

The resource that defines how this PCam should be transitioned to.

Can be shared across multiple PCams.

See the Tween page for more details.


Setter

void set_tween_resource(PhantomCameraTween tween_resource)

Example
gdscript
pcam.set_tween_resource(tween_resource)

Getter

PhantomCameraTween get_tween_resource()

Example
gdscript
pcam.get_tween_resource()

tween_duration

Type: float

Default: 1

Property reference to tween_duration of the PhantomCameraTween.


Setter

void set_tween_duration(float value)

Example
gdscript
pcam.set_tween_duration(value)

Getter

float get_tween_duration()

Example
gdscript
pcam.get_tween_duration()

tween_transition

Type: int

Default: 0

Property reference to tween_transition of the PhantomCameraTween.


Setter

void set_tween_ease(int value)

Example
gdscript
pcam.set_tween_transition(value)

Getter

float get_tween_transition()

Example
gdscript
pcam.get_tween_transition()

tween_ease

Type: int

Default: 2

Property reference to tween_ease of the PhantomCameraTween.


Setter

void set_tween_ease(int value)

Example
gdscript
pcam.set_tween_ease(value)

Getter

float get_tween_ease()

Example
gdscript
pcam.get_tween_ease()

camera_3d_resource

Type: Camera3DResource

Default: null

A resource type that allows for overriding the Camera3D node's properties.

See the Camera3DResource page for more details.


Setter

void set_camera_3d_resource(Camera3DResource resource)

Example
gdscript
pcam.set_camera_3d_resource(resource)

Getter

Camera3DResource get_camera_3d_resource()

Example
gdscript
pcam.get_camera_3d_resource()

cull_mask

Type: int

Default: 1048575

Property reference to cull_mask property of the Camera3DResource.


Setter

void set_cull_mask(int value)

Example
gdscript
pcam.set_cull_mask(value)

Getter

int get_cull_mask()

Example
gdscript
pcam.get_cull_mask()

h_offset

Type: float

Default: 0

Property reference to h_offset property of the Camera3DResource.


Setter

void set_h_offset(float value)

Example
gdscript
pcam.set_h_offset(4.2)

Getter

float get_h_offset()

Example
gdscript
pcam.get_h_offset()

v_offset

Type: float

Default: 0

Property reference to v_offset property of the Camera3DResource.


Setter

void set_v_offset(float value)

Example
gdscript
pcam.set_v_offset(4.2)

Getter

float get_v_offset()

Example
gdscript
pcam.get_v_offset()

projection

Type: int

Default: 0

Property reference to projection property of the Camera3DResource.


Setter

void set_projection(int value)

Example
gdscript
pcam.set_projection(2)

Getter

int get_projection()

Example
gdscript
pcam.get_projection()

fov

Type: float

Default: 75

Property reference to fov property of the Camera3DResource.


Setter

void set_fov(float value)

Example
gdscript
pcam.set_fov(4.2)

Getter

float get_fov()

Example
gdscript
pcam.get_fov()

size

Type: float

Default: 1

Property reference to size property of the Camera3DResource.


Setter

void set_size(float value)

Example
gdscript
pcam.set_size(4.2)

Getter

float get_size()

Example
gdscript
pcam.get_size()

frustum_offset

Type: Vector2

Default: Vector2(0, 0, 0)

Property reference to frustum_offset property of the Camera3DResource.


Setter

void set_frustum_offset(Vector2 value)

Example
gdscript
pcam.set_frustum_offset(Vector2(4, 2))

Getter

float get_frustum_offset()

Example
gdscript
pcam.get_frustum_offset()

near

Type: float

Default: 0.05

Property reference to near property of the Camera3DResource.


Setter

void set_near(float value)

Example
gdscript
pcam.set_near(value)

Getter

float get_near()

Example
gdscript
pcam.get_near()

far

Type: float

Default: 4000

Property reference to far property of the Camera3DResource.


Setter

void set_far(float value)

Example
gdscript
pcam.set_far(value)

Getter

float get_far()

Example
gdscript
pcam.get_far()

attributes

Type: CameraAttributes

Default: null

Allows for setting and dynamically tweening between CameraAttribute resources for each PCam3D. Used to enable and transition between things like depth-of-field, i.e. camera blur, and camera light exposure.

Important

If a CameraAttribute resource is already applied to a Camera3D node, then adding one to a PCam3D will automatically override it once that PCam3D becomes active.

Again, using an Attribute resource on the PCam3D should be intended as a means of dynamically switching between different resources for tweens. In other words, if a project, or scene, only needs one CameraAttribute resource, then consider using a WorldEnvironemnt node or apply it directly to Camera3D node instead.

Important

Aside from a few exposure properties, any tweening between different CameraAttribute resources will only occur if the types are the same. So for best results, stick to using just CameraAttributePractical or CameraAttributePhysical.

Important

If applying a CameraAttribute resource to a PCam3D, then the Camera3D will retain the most recently applied one if the consequent active PCam3Ds have no CameraAttribute applied. So if you want to move away from a current CameraAttribute setting, or reset it to default values, you would need to have another, active, PCam3D with another CameraAttribute resource with the desired changes / defaults.


Setter

void set_attributes(CameraAttributes value)

Example
gdscript
pcam.set_attributes(value)

Getter

CameraAttributes get_attributes()

Example
gdscript
pcam.get_attributes()

environment

Type: Environment

Default: null

Allows for setting a Environment resources for individual PCam3Ds. The properties of this resource will not be tweened between each PCam3D that has resource.

Important

Only consider using this if there is a desire to change the environment variable per PCam3D instance. Otherwise, consider using a WorldEnvironemnt node or apply it directly to Camera3D node instead.


Setter

void set_environment(Environment value)

Example
gdscript
pcam.set_environment(value)

Getter

Environment get_environment()

Example
gdscript
pcam.get_environment()

noise

Type: PhantomCameraNoise3D

Default: null

Applies a noise, or shake, to a Camera3D. Once set, the noise will run continuously after the tween to the PhantomCamera3D is complete.


Setter

void set_noise(PhantomCameraNoise3D value)

Example
gdscript
pcam.set_noise(noise_resource)

Getter

PhantomCameraNoise3D get_noise()

Example
gdscript
pcam.get_noise()

preview_noise

Type: bool

Default: true

If true, will trigger the noise while in the editor.

Useful in cases where you want to temporarily disabled the noise in the editor without removing the resource.

This property has no effect on runtime behaviour.

Note: This property is only accessible within the node's inspector panel in the editor.

noise_emitter_layer

Type: int

Default: 0

Enable a corresponding layer for a PhantomCameraNoiseEmitter3D noise_emitter_layer to make this PhantomCamera3D be affected by it.

Note: The value used for this is a bitmask, for improved usability, a helper setter function is also available.


Setter

void set_noise_emitter_layer(int value)

void set_noise_emitter_layer_value(int layer, bool enabled)

Example
gdscript
## Bitmask assignment
pcam.get_noise_emitter_layer(16)

## Specific layer change
pcam.set_noise_emitter_layer_value(2, true)

Getter

int get_noise_emitter_layer()

Example
gdscript
pcam.get_noise_emitter_layer()

Methods

emit_noise

Type: Transform3D

Default: Transform3D()

Emits a noise based on a custom Transform3D value.

Use this function if you wish to make use of external noise patterns from, for example, other addons.


Setter

void emit_noise(Transform3D value)

Example
gdscript
pcam.emit_noise(transform_value)

Signals

became_active

Emitted when the PCam becomes active.

became_inactive

Emitted when the PCam becomes inactive.

dead_zone_changed

Emitted when the dead zone changes when in Framed Follow mode.

dead_zone_reached

Emitted when a target touches the edge of the dead zone in Framed Follow mode.

follow_target_changed

Emitted when the follow target changes.

is_tweening

Emitted when the Camera is being tweened.

look_at_target_changed

Emitted when look_at_target changes.

tween_started

Emitted when the Camera starts to tween to the PCam.

tween_interrupted(PhantomCamera pcam)

Emitted when the tween is interrupted due to another PCam becoming active.

The argument is the PCam that interrupted the tween.

tween_completed

Emitted when the Camera completes its tween to the PCam.