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
pcam_emitter.set_noise(noise_resource)
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.
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.
duration
Type: float
Default: 1
Sets the duration for the camera noise if continuous is set to false.
The value is set in seconds.
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.
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
# 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
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
noise_emitter.emit()
bool
is_emitting()
Returns the state for the emitter. If true, the emitter is currently emitting.
Example
noise_emitter.is_emitting()