Skip to content
PhantomCameraNoiseEmitter2D

PhantomCameraNoiseEmitter2D

Inherits: Node2D

Is a node meant to apply positional and rotational noise, also referred to as shake, to the Camera2D. 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: PhantomCameraNoise2D

Default: null

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


Setter

void set_noise (PhantomCameraNoise2D value)

Example
gdscript
pcam_emitter.set_noise(noise_resource)

Getter

PhantomCameraNoise2D 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 PhantomCamera2D nodes with at least one corresponding layer enabled. Enabling multiple corresponding layers on the same PhantomCamera2D causes no additional effect.


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()

Methods

emit

Type: n/a

Default: n/a

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


Setter

void emit()

Example
gdscript
noise_emitter.emit()

is_emitting

Type: n/a

Default: n/a

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


Getter

bool is_emitting()

Example
gdscript
noise_emitter.is_emitting()

stop

Type: n/a

Default: n/a

Stops the emitter from emitting noise.


Setter

void stop()

Example
gdscript
noise_emitter.stop()

toggle

Type: n/a

Default: n/a

Toggles the emitter on and off.


Setter

void toggle()

Example
gdscript
noise_emitter.toggle()