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
Follow Mode
Enables the PCam3D
to follow specific target(s) using various logics.
Secondary Properties
active
Type: bool
Default: false
Returns true
if this PCam
is the one controlling the scene's Camera
.
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.
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 Mode | Value |
---|---|
ALWAYS | 0 |
NEVER | 1 |
Setter
void
set_inactive_update_mode(int
update_mode)
Example
pcam.set_inactive_update_mode(InactiveUpdateMode.NEVER)
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
pcam.set_tween_resource(tween_resource)
tween_duration
Type: float
Default: 1
Property reference to tween_duration of the PhantomCameraTween
.
tween_transition
Type: int
Default: 0
Property reference to tween_transition of the PhantomCameraTween
.
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
pcam.set_camera_3d_resource(resource)
cull_mask
Type: int
Default: 1048575
Property reference to cull_mask property of the Camera3DResource
.
frustum_offset
Type: Vector2
Default: Vector2(0, 0, 0)
Property reference to frustum_offset property of the Camera3DResource
.
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.
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.
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. Note: This is only applicable 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
.