Skip to content
PhantomCameraNoiseEmitter3D

PhantomCameraNoiseEmitter3D

Inherits: Node3D

Is a node meant to apply positional and rotational noise, also referred to as shake, to the Camera3D. It is designed for use cases such as when hitting or when being hit, earthquakes or to add a bit of slight movement to the camera to make it feel less static.

The emitter can affect multiple PCams in a given scene based on which noise_emitter_layer are enabled.

To trigger the emitter, simply call its emit function.

Properties

noise

Type: PhantomCameraNoise3D

Default: null

The PhantomCameraNoise3D resource that defines the noise pattern for this emitter.


Setter

void set_noise (PhantomCameraNoise3D noise_resource)

Example
gdscript
pcam_emitter.set_noise(noise_resource)

Getter

PhantomCameraNoise3D get_noise()

Example
gdscript
pcam_emitter.get_noise()

preview

Type: bool

Default: false

If true, previews the noise in the editor - can be seen in the viewfinder.

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

continous

Type: bool

Default: false

If true, repeats the noise indefinitely once started. Otherwise, it will only be triggered once.


Setter

void set_continuous (bool value)

Example
gdscript
pcam_emitter.set_continuous(true)

Getter

bool get_continuous()

Example
gdscript
pcam_emitter.get_continuous()

growth_time

Type: float

Default: 0

Determines how long the noise should take to reach full intensity once started.

The value is set in seconds.


Setter

void set_growth_time (float value)

Example
gdscript
pcam_emitter.set_growth_time(0.1)

Getter

float get_growth_time()

Example
gdscript
pcam_emitter.get_growth_time()

duration

Type: float

Default: 1

Sets the duration for the camera noise if continuous is set to false.

The value is set in seconds.


Setter

void set_duration (float value)

Example
gdscript
pcam.set_duration(0.42)

Getter

float get_duration()

Example
gdscript
pcam_emitter.get_duration()

decay_time

Type: float

Default: 0

Determines how long the noise should take to come to a full stop.

The value is set in seconds.


Setter

void set_decay_time (float value)

Example
gdscript
pcam_emitter.set_decay_time(0.1)

Getter

float get_decay_time()

Example
gdscript
pcam_emitter.get_decay_time()

noise_emitter_layer

Type: int

Default: 1

Enabled layers will affect PhantomCamera3D nodes with at least one corresponding layer enabled. Note: The layer value uses a bitmask.

Enabling multiple corresponding layers on the same PhantomCamera3D causes no additional effect.

Note: The layer value uses a bitmask.

Tip

A helper function also exists called set_noise_emitter_layer_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_noise_emitter_layer (int value)

void set_noise_emitter_layer_value (int layer, bool enabled)

Example
gdscript
# Bitmask assignment
pcam_emitter.set_noise_emitter_layer(10) # Enables the 2nd and 4th layer using a bitmask value

## Specific layer change
pcam_emitter.set_noise_emitter_layer_value(4, true) # Enables the 4th layer

Getter

int get_noise_emitter_layer()

Example
gdscript
pcam_emitter.get_noise_emitter_layer() # Returns the layer value as a bitmask

Methods

void emit()

Emits the noise from the emitter based on the applied PhantomCameraNoise3D resource and various properties assigned.
It will affect all active PCam3Ds with at least one matching noise_emitter_layer.

Example
gdscript
noise_emitter.emit()

bool is_emitting()

Returns the state for the emitter. If true, the emitter is currently emitting.

Example
gdscript
noise_emitter.is_emitting()

void stop

Stops the emitter from emitting noise.

Example
gdscript
noise_emitter.stop()

void toggle

Toggles the emitter on or off.

Example
gdscript
noise_emitter.toggle()