### Get Camera3D Size (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Shows a GDScript example for getting the size property of a Camera3D resource. This is useful for checking the size setting, particularly for orthogonal and frustum cameras. ```gdscript pcam.get_size() ``` -------------------------------- ### Example Setup for Mouse Input Control (GDScript) Source: https://phantom-camera.dev/follow-modes/third-person An example script demonstrating how to handle mouse input to control the rotation of the phantom camera. It uses getters and setters for rotation degrees and includes clamping and wrapping logic for pitch and yaw. ```gdscript var mouse_sensitivity: float = 0.05 var min_yaw: float = 0 var max_yaw: float = 360 var min_pitch: float = -89.9 var max_pitch: float = 50 func _unhandled_input(event) -> void: # Trigger whenever the mouse moves. if event is InputEventMouseMotion: var pcam_rotation_degrees: Vector3 # Assigns the current 3D rotation of the SpringArm3D node - to start off where it is in the editor. pcam_rotation_degrees = pcam.get_third_person_rotation_degrees() # Change the X rotation. pcam_rotation_degrees.x -= event.relative.y * mouse_sensitivity # Clamp the rotation in the X axis so it can go over or under the target. pcam_rotation_degrees.x = clampf(pcam_rotation_degrees.x, min_pitch, max_pitch) # Change the Y rotation value. pcam_rotation_degrees.y -= event.relative.x * mouse_sensitivity # Sets the rotation to fully loop around its target, but without going below or exceeding 0 and 360 degrees respectively. pcam_rotation_degrees.y = wrapf(pcam_rotation_degrees.y, min_yaw, max_yaw) # Change the SpringArm3D node's rotation and rotate around its target. pcam.set_third_person_rotation_degrees(pcam_rotation_degrees) ``` -------------------------------- ### Get Camera3D Near Clipping Plane (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Shows a GDScript example for getting the near clipping plane distance of a Camera3D resource. This allows checking the minimum renderable distance for the camera. ```gdscript pcam.get_near() ``` -------------------------------- ### Get Camera3D Horizontal Offset (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Shows a GDScript example for getting the current horizontal offset (h_offset) of a Camera3D resource. This helps in reading the camera's current horizontal positioning. ```gdscript pcam.get_h_offset() ``` -------------------------------- ### Get Camera3D Projection Type (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Shows a GDScript example for getting the current projection type of a Camera3D resource. This helps in determining whether the camera is set to perspective, orthogonal, or frustum view. ```gdscript pcam.get_projection() ``` -------------------------------- ### Get Camera3D Cull Mask (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Provides a GDScript example for retrieving the current cull_mask value of a Camera3D resource. This is useful for inspecting which layers are currently being rendered. ```gdscript pcam.get_cull_mask() ``` -------------------------------- ### Get PCam3D Tween Resource (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d This snippet shows how to retrieve the currently assigned PhantomCameraTween resource from a PCam3D. This resource dictates how the camera transitions. ```gdscript var tween_resource = pcam.get_tween_resource() ``` -------------------------------- ### Set Camera3D Frustum Offset (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Provides a GDScript example for setting the frustum_offset for a Camera3D resource. This property is specifically used when the projection is set to Frustum. ```gdscript pcam.set_frustum_offset(Vector2(4.2, 4.2)) ``` -------------------------------- ### Get From Tween Resources for TweenDirectorResource Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the list of PhantomCameraTween resources currently configured as 'From' targets. This is used when 'from_type' is set to TWEEN_RESOURCE. ```gdscript pcam_tween_director.get_from_tween_resources() ``` -------------------------------- ### Get From Type for TweenDirectorResource Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the current 'From' type setting for the TweenDirectorResource. This indicates how the 'From' targets are identified for triggering tween overrides. ```gdscript pcam_tween_director.get_from_type() ``` -------------------------------- ### Get Camera3D Frustum Offset (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Illustrates how to retrieve the frustum_offset from a Camera3D resource using GDScript. This allows checking the offset values for frustum-based camera projections. ```gdscript pcam.get_frustum_offset() ``` -------------------------------- ### Get Follow Targets in Phantom Camera (GDScript) Source: https://phantom-camera.dev/follow-modes/group Shows how to retrieve the current list of nodes being followed by the Phantom Camera. This is useful for inspecting or modifying the follow group dynamically. ```gdscript pcam.get_follow_targets() ``` ```gdscript pcam.get_follow_targets() ``` -------------------------------- ### Get Environment Resource Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d Retrieves the currently assigned Environment resource for a PCam3D instance. This function returns the Environment object associated with the camera. ```gdscript pcam.get_environment() ``` -------------------------------- ### Get To Tween Resources for TweenDirectorResource Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the list of PhantomCameraTween resources currently configured as 'To' targets. This is used when 'to_type' is set to TWEEN_RESOURCE. ```gdscript pcam_tween_director.get_to_tween_resources() ``` -------------------------------- ### Set Camera3D Field of View (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Provides a GDScript example for setting the Field of View (fov) for a Camera3D resource. This property is only applicable when the projection is set to Perspective. ```gdscript pcam.set_fov(4.2) ``` -------------------------------- ### Get From Phantom Cameras for TweenDirectorResource Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the list of NodePaths for PCams currently configured as 'From' targets. This allows inspection of which individual cameras are set to trigger overrides. ```gdscript pcam_tween_director.get_from_phantom_cameras() ``` -------------------------------- ### Get Tween Resource for PhantomCamera2D (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the PhantomCameraTween resource currently assigned to this PCam2D, which dictates its transition properties. Returns null if no specific resource is set. ```gdscript pcam.get_tween_resource() ``` -------------------------------- ### Get PCam3D Host Layers (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d This snippet shows how to retrieve the current host layers configuration for a PCam3D. The returned value is a bitmask representing the enabled layers. ```gdscript var layers = pcam.get_host_layers() ``` -------------------------------- ### Get PCamHost Layers (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Retrieves the current layer value of a PCamHost as a bitmask. This value indicates which PCam nodes the host is configured to recognize. ```gdscript pcam_host.get_host_layers() # Returns the layer value as a bitmask ``` -------------------------------- ### Get To Type for TweenDirectorResource Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the current 'To' type setting for the TweenDirectorResource. This indicates how the 'To' targets are identified for applying tween overrides. ```gdscript pcam_tween_director.get_to_type() ``` -------------------------------- ### Get Up Target Node - GDScript Source: https://phantom-camera.dev/look-at-modes/overview Retrieves the currently assigned Node3D that is used as a target for the camera's upward direction. If no target is set, this will return null. ```gdscript pcam.get_up_target() ``` -------------------------------- ### Get Camera3D Vertical Offset (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Illustrates how to retrieve the vertical offset (v_offset) from a Camera3D resource using GDScript. This allows checking the camera's current vertical positioning. ```gdscript pcam.get_camera_v_offset() ``` -------------------------------- ### Get Active PCam from PCamHost (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Retrieves the currently active PCam2D or PCam3D node associated with this PCamHost. This is the camera node whose logic is currently being supplied by the host. ```gdscript pcam_host.get_active_pcam() ``` -------------------------------- ### Get Snap to Pixel Setting for Camera2D Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the current snap-to-pixel setting for the Camera2D. This boolean value indicates whether the camera is currently set to snap to whole pixels. ```gdscript pcam.get_snap_to_pixel() ``` -------------------------------- ### Get or Set Tweening on Load for PCam3D (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d This snippet demonstrates how to retrieve the current state of the 'tween on load' property and how to set it. This property determines if a PCam3D performs a tween transition upon instantiation. ```gdscript # Get the current state var tween_on_load_enabled = pcam.get_tween_on_load() # Set the state pcam.set_tween_on_load(false) ``` -------------------------------- ### Get To Phantom Cameras for TweenDirectorResource Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the list of NodePaths for PCams currently configured as 'To' targets. This allows inspection of which individual cameras are set to receive the overridden tween. ```gdscript pcam_tween_director.get_to_phantom_cameras() ``` -------------------------------- ### Get PCamHost Interpolation Mode (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Retrieves the current interpolation mode of the PCamHost. This value dictates whether the controlled PCam nodes use physics interpolation and how they update. ```gdscript pcam_host.get_interpolation_mode() # Returns the current interpolation mode ``` -------------------------------- ### Initialize Phantom Camera and Host in C# Source: https://phantom-camera.dev/c-sharp-wrapper Demonstrates how to get references to PhantomCamera2D and PhantomCameraHost nodes in C#. It shows how to cast Node2D to PhantomCamera2D and access the PhantomCameraManager singleton to retrieve a PhantomCameraHost. Priority can be set on the camera. ```csharp using Godot; using PhantomCamera; using PhantomCamera.Manager; public partial class MyClassName : Node { private PhantomCamera2D _pcam; private PhantomCameraHost _pcamHost; public override void _Ready() { // PhantomCamera reference _pcam = GetNode("%PhantomCamera2D").AsPhantomCamera2D(); _pcam.Priority = 40; // Changes the priority of the PCam to 40 // PhantomCameraHost reference using the PhantomCameraManager singleton _pcamHost = PhantomCameraManager.PhantomCameraHosts[0]; // Fetches the first PCamHost through the PCamManager singleton GD.Print(_pcamHost.HostLayers); // Outputs the host_layer value of the PCamHost } } ``` -------------------------------- ### Get Tween on Load Status for PhantomCamera2D (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the current state of the 'tween on load' property for a PhantomCamera2D. This indicates whether the camera will perform a tween transition upon instantiation. ```gdscript pcam.get_tween_on_load() ``` -------------------------------- ### PhantomCameraHost Methods Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Methods available for interacting with and controlling the PhantomCameraHost node. ```APIDOC ## Methods ### `Node` get_active_pcam Returns the currently active `PCam2D` / `PCam3D` for this `PCamHost` node. Example gdscript ```gdscript pcam_host.get_active_pcam() ``` ### `void` process (`float` delta) Manually updates the process for this `PCamHost`. **Important**: This function should only be needed if InterpolationMode is set to `InterpolationMode.MANUAL`. Example gdscript ```gdscript pcam_host.process(delta) ``` ``` -------------------------------- ### Phantom Camera - Rotation with Target Source: https://phantom-camera.dev/follow-modes/simple Details properties related to making the camera copy the rotation of its follow target. ```APIDOC ## Phantom Camera - Rotation with Target ### Description Properties for enabling and controlling the camera's rotation to match its follow target. ### Properties #### `rotate_with_target` - **Type**: `bool` - **Default**: `false` - **Description**: Makes the `PhantomCamera2D` copy the rotation of its `follow_target`. This behavior is only available when `follow_mode` is set and has only one `follow_target`. **Important**: Be sure to disable `ignore_rotation` on the `Camera2D` node to enable this feature. This property is for `PCam2D` **_only_**. ##### Setter `void` set_rotate_with_target(`bool` enable) ```gdscript pcam.set_rotate_with_target(true) ``` ##### Getter `float` get_rotate_with_target() ```gdscript pcam.get_rotate_with_target() ``` #### `rotation_offset` - **Type**: `float` - **Default**: `0` - **Description**: Offsets the rotation when `rotate_with_target` is enabled. This property is for `PCam2D` **_only_**. ##### Setter `void` set_rotation_offset(`float` rotation_offset) ```gdscript pcam.set_rotation_offset(42) ``` ##### Getter `float` get_rotation_offset() ```gdscript pcam.get_rotation_offset() ``` #### `rotation_damping` - **Type**: `bool` - **Default**: `false` - **Description**: Enables rotational damping when `rotate_with_target` is enabled. This property is for `PCam2D` **_only_**. ##### Setter `void` set_rotation_damping(`bool` enable) ```gdscript pcam.set_rotation_damping(true) ``` ##### Getter `bool` get_rotation_damping() ```gdscript pcam.set_rotation_damping() ``` #### `rotation_damping_value` - **Type**: `float` - **Default**: `0.1` - **Description**: Defines the damping amount for the `rotate_with_target`. This property is for `PCam2D` **_only_**. ##### Setter `void` set_rotation_damping_value(`float` damping_value) ```gdscript pcam.set_rotation_damping_value(0.42) ``` ##### Getter `float` get_rotation_damping_value() ```gdscript pcam.get_rotation_damping_value() ``` ``` -------------------------------- ### C# Phantom Camera: Accessing Property (With Wrapper) Source: https://phantom-camera.dev/c-sharp-wrapper Demonstrates how to safely access and modify the 'priority' property of a PCam node using the C# wrapper. This method leverages typed references, providing autocomplete and compile-time error checking, unlike direct string-based access. ```csharp _pcam.Priority = 10 // With the wrapper ``` -------------------------------- ### Get Follow Target Node for Phantom Camera (GDScript) Source: https://phantom-camera.dev/follow-modes/glued Retrieves the currently set follow target node for the Phantom Camera. This function can return either a Node2D or Node3D depending on the scene setup. ```gdscript pcam.get_follow_target_node() ``` -------------------------------- ### Manage Follow Targets in Phantom Camera (GDScript) Source: https://phantom-camera.dev/follow-modes/group Demonstrates how to set, append, and remove nodes from the Phantom Camera's follow group. This is essential for configuring which objects the camera should track. ```gdscript # Assigns a new array of nodes to the Follow Group pcam.set_follow_targets(node_collection) # Appends one node to the Follow Group pcam.append_follow_targets(player_node) # Appends an array of nodes to the Follow Group pcam.append_follow_targets_array(node_array) # Removes a node from the Follow Group pcam.erase_follow_targets(another_node) ``` ```gdscript # Assigns a new array of nodes to the Follow Group pcam.set_follow_targets(node_collection) # Appends one node to the Follow Group pcam.append_follow_targets(player_node) # Appends an array of nodes to the Follow Group pcam.append_follow_targets_array(node_array) # Removes a node from the Follow Group pcam.erase_follow_targets(another_node) ``` -------------------------------- ### Get Auto Follow Distance Minimum (PCam3D) Source: https://phantom-camera.dev/follow-modes/group Retrieves the minimum distance setting for PCam3D's auto-follow functionality. This method returns a float representing the closest the camera will get to the target. ```gdscript pcam.get_auto_follow_distance_min() ``` -------------------------------- ### Get Vertical Offset Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d Retrieves the current vertical offset of the camera. Returns a float. ```gdscript pcam.get_v_offset() ``` -------------------------------- ### Get Camera3D Resource Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d Retrieves the current Camera3D resource associated with the PCam3D. This function returns a Camera3DResource object. ```gdscript pcam.get_camera_3d_resource() ``` -------------------------------- ### Set PCamHost Layers using Bitmask and Specific Value (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Demonstrates how to set the host_layers property of a PCamHost. The first example uses a bitmask to enable multiple layers, while the second uses a helper function to enable or disable a specific layer. This property determines which PCam nodes the PCamHost recognizes. ```gdscript ## Bitmask assignment pcam_host.set_host_layers(10) # Enables the 2nd and 4th layer using a bitmask value ## Specific layer change pcam_host.set_host_layers_value(4, true) # Enables the 4th layer ``` -------------------------------- ### Get Camera Noise Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the current noise setting for the camera. This returns an integer representing the noise configuration. ```gdscript pcam.get_noise() ``` -------------------------------- ### Get PhantomCameraNoise3D Rotational Multiplier Y (GDScript) Source: https://phantom-camera.dev/resource-types/phantom-camera-noise-3d Retrieves the current multiplier for rotational noise on the Y-axis. Returns a float value. ```gdscript pcam.noise.get_rotational_multiplier_y() ``` -------------------------------- ### Implement DIY Physics Interpolation for Jitter Reduction in Godot Source: https://phantom-camera.dev/support/faq This GDScript code demonstrates a DIY approach to reduce jitter in Godot by interpolating the visual representation of a physics body. It separates the visual node's movement from the physics process, preventing jitter when the physics body is moving. This method is a simplified version of the smoothing-addon. ```gdscript extends CharacterBody3D # or CharacterBody2D var _player_visual # Type: Node2D/3D var _physics_body_tran_last # Type: Transform2D/3D var _physics_body_tran_current # Type: Transform2D/3D func _ready() -> void: # Prevents the visual node from be affected by the movement of its parent _player_visual.top_level = true func _physics_process(delta: float) -> void: _physics_body_tran_last = _physics_body_tran_current _physics_body_tran_current = global_transform # The global_transform here referring to your physics-node # e.g. CharacterBody2D/3D # Other code like movement logic func _process(_delta: float) -> void: _player_visual.global_transform = _physics_body_tran_last.interpolate_with( _physics_body_tran_current, Engine.get_physics_interpolation_fraction() ) ``` -------------------------------- ### Phantom Camera - Simple Follow Mode Source: https://phantom-camera.dev/follow-modes/simple Details the 'Simple Follow' mode for the Phantom Camera, which allows the camera to follow a target node with optional offsets. ```APIDOC ## Phantom Camera - Simple Follow Mode ### Description This mode has similar logic to `Glued Follow`, but with the additional option to be offset from its target location. This mode is useful for things like character controllers in a fixed angle perspective. ### Properties #### `follow_target` - **Type**: `Node2D` (for 2D) or `Node3D` (for 3D) - **Default**: `null` - **Description**: Determines which `Node` should be followed. The `Camera` will follow the position of the `Follow Target` based on the `Follow Mode` type and its parameters. ##### Setter `void` set_follow_target(`Node2D` target_node) ```gdscript pcam.set_follow_target(player_node) ``` ##### Getter `Node2D` get_follow_target_node() (for 2D) `Node3D` get_follow_target_node() (for 3D) ```gdscript pcam.get_follow_target_node() ``` #### `follow_offset` - **Type**: `Vector2` (for 2D) or `Vector3` (for 3D) - **Default**: `Vector2(0,0)` - **Description**: Offsets the follow target's position. ##### Setter `void` set_follow_offset(`Vector2` offset) (for 2D) `void` set_follow_offset(`Vector3` offset) (for 3D) ```gdscript pcam.set_follow_offset(Vector2(1, 1)) ``` ```gdscript pcam.set_follow_offset(Vector3(1, 1, 1)) ``` ##### Getter `Vector2` get_follow_offset() (for 2D) `Vector3` get_follow_offset() (for 3D) ```gdscript pcam.get_follow_offset() ``` #### `follow_damping` - **Type**: `bool` - **Default**: `false` - **Description**: Applies a damping effect on the `Camera`'s movement, leading to heavier/slower camera movement as the targeted node moves around. Useful to avoid sharp and rapid camera movement. ##### Setter `void` set_follow_damping(`bool` enable) ```gdscript pcam.set_follow_damping(true) ``` ##### Getter `bool` get_follow_damping() ```gdscript pcam.get_follow_damping() ``` #### `damping_value` - **Type**: `Vector2` (for 2D) or `Vector3` (for 3D) - **Default**: `Vector2(0.1, 0.1)` - **Description**: Defines the damping amount. The ideal range is between 0-1, likely around 0.1-0.25. The damping amount is specified per axis (X and Y for 2D, X, Y, and Z for 3D). Lower values result in faster/sharper movement, while higher values result in slower/heavier movement. ##### Setter `void` set_follow_damping_value(`Vector2` damping_value) (for 2D) `void` set_follow_damping_value(`Vector3` damping_value) (for 3D) ```gdscript pcam.set_follow_damping_value(Vector2(0.2, 0.2)) ``` ```gdscript pcam.set_follow_damping_value(Vector3(0.2, 0.2, 0.2)) ``` ##### Getter `Vector2` get_follow_damping_value() (for 2D) `Vector3` get_follow_damping_value() (for 3D) ```gdscript pcam.get_follow_damping_value() ``` ``` -------------------------------- ### Get Camera Limit Margin Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the limit margin of the TileMap or TileMapLayer. This is useful for understanding the boundaries within which the camera operates. ```gdscript pcam.get_limit_margin() ``` -------------------------------- ### Get PhantomCameraNoise3D Positional Multiplier Z (GDScript) Source: https://phantom-camera.dev/resource-types/phantom-camera-noise-3d Retrieves the current multiplier for positional noise on the Z-axis. Returns a float value. ```gdscript pcam.noise.get_positional_multiplier_z() ``` -------------------------------- ### Casting Addon Nodes to C# Types Source: https://phantom-camera.dev/c-sharp-wrapper Illustrates the necessary casting methods for various Phantom Camera addon node types when referencing them in C#. This is required because addon nodes are defined in GDScript and need explicit casting in C#. ```csharp _pcam2D = GetNode("PathToNode").AsPhantomCamera2D(); // PhantomCamera2D _pcam3D = GetNode("PathToNode").AsPhantomCamera3D(); // // PhantomCamera3D _pcamHost = GetNode("PathToNode").AsPhantomCameraHost(); // PhantomCameraHost _pcamNoiseEmitter2D = GetNode("PathToNode").AsPhantomCameraNoiseEmitter2D(); // PhantomCameraNoiseEmitter2D _pcamNoiseEmitter3D = GetNode("PathToNode").AsPhantomCameraNoiseEmitter3D(); // PhantomCameraNoiseEmitter3D ``` -------------------------------- ### Get PhantomCameraNoise3D Rotational Multiplier Z (GDScript) Source: https://phantom-camera.dev/resource-types/phantom-camera-noise-3d Retrieves the current multiplier for rotational noise on the Z-axis. Returns a float value. ```gdscript pcam.noise.get_rotational_multiplier_z() ``` -------------------------------- ### Set Up Target Node - GDScript Source: https://phantom-camera.dev/look-at-modes/overview Assigns a Node3D to be used as a target for the camera's upward direction. When an up_target is set, it overrides the 'up' property and continuously updates the camera's orientation based on this target. ```gdscript pcam.set_up_target(node_target) ``` -------------------------------- ### Set Up Direction - GDScript Source: https://phantom-camera.dev/look-at-modes/overview Sets the upward direction for the Phantom Camera. This is particularly relevant when a look at mode is active. The input is a Vector3 representing the desired up direction. ```gdscript pcam.set_up(Vector3(1, 1, 0)) ``` -------------------------------- ### Get PhantomCameraNoise3D Rotational Multiplier X (GDScript) Source: https://phantom-camera.dev/resource-types/phantom-camera-noise-3d Retrieves the current multiplier for rotational noise on the X-axis. Returns a float value. ```gdscript pcam.noise.get_rotational_multiplier_x() ``` -------------------------------- ### Set Camera3D Size (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Demonstrates setting the size property for a Camera3D resource using GDScript. This property is relevant for Orthogonal and Frustum projection types. ```gdscript pcam.set_size(4.2) ``` -------------------------------- ### Mimic Look At (3D) Properties Source: https://phantom-camera.dev/look-at-modes/mimic This section details the properties associated with the Mimic Look At (3D) feature, including setting the look-at target, and controlling damping effects. ```APIDOC ## Mimic Look At (3D) Properties ### Description Controls the 3D look-at behavior of the Phantom Camera, allowing it to follow a target node's rotation. ### Properties #### `look_at_target` - **Type**: `Node3D` - **Default**: `null` - **Description**: Determines which `Node3D` should be looked at. The `PCam3D` will update its rotational value as the target changes its position. ##### Setter `void` set_look_at_target(`Node3D` target) - **Example**: ```gdscript pcam.set_look_at_target(target_node) ``` ##### Getter `Node3D` get_look_at_target() - **Example**: ```gdscript pcam.get_look_at_target() ``` #### `look_at_damping` - **Type**: `bool` - **Default**: `false` - **Description**: Applies a damping effect on the `Camera3D`'s rotation, leading to slower camera turning as the targeted node moves. Useful to avoid sharp and rapid camera rotational movement. ##### Setter `void` set_look_at_damping(`bool` enable) - **Example**: ```gdscript pcam.set_look_at_damping(true) ``` ##### Getter `bool` get_look_at_damping() - **Example**: ```gdscript pcam.get_look_at_damping() ``` #### `look_at_damping_value` - **Type**: `float` - **Default**: `false` - **Description**: Defines the damping amount. The ideal range is between 0-1. Lower values result in faster/sharper camera movement, while higher values result in slower/heavier camera movement. ##### Setter `void` set_look_at_damping_value(`float` damping_value) - **Example**: ```gdscript pcam.set_look_at_damping_value(0.15) ``` ##### Getter `float` get_look_at_damping_value() - **Example**: ```gdscript pcam.get_look_at_damping_value() ``` ``` -------------------------------- ### Get PhantomCameraTweenDirector Source: https://phantom-camera.dev/secondary-nodes/phantom-camera-tween-director Retrieves the current list of TweenDirectorResource objects applied to the PhantomCameraTweenDirector. This list defines custom tweening behavior between specific PCams. ```gdscript pcam_host.get_tween_director() # Returns the list of TweenDirectorResources applied ``` -------------------------------- ### C# Phantom Camera: Accessing Property (Without Wrapper) Source: https://phantom-camera.dev/c-sharp-wrapper Illustrates the traditional, less safe method of accessing and modifying the 'priority' property of a PCam node in C# without the wrapper. This approach uses string references, which are prone to runtime errors due to typos and lack IDE support for validation. ```csharp _pcam.Set("priority", 10); // Without the wrapper ``` -------------------------------- ### Get PhantomCameraNoise2D Resource Source: https://phantom-camera.dev/secondary-nodes/phantom-camera-noise-emitter-2d Retrieves the currently assigned PhantomCameraNoise2D resource from the emitter. This allows inspection or modification of the noise pattern. It returns a PhantomCameraNoise2D object. ```gdscript pcam_emitter.get_noise() ``` -------------------------------- ### PhantomCameraTween Properties Source: https://phantom-camera.dev/resource-types/phantom-camera-tween This section details the properties of the PhantomCameraTween resource, including duration, transition type, and ease type. ```APIDOC ## PhantomCameraTween > Inherits: Resource Defines how `PCams` transition between one another. Changing the tween values for a given `PCam` determines how transitioning _to that_ instance will look like. ### Properties #### duration - **Type**: `float` - **Default**: `1` - **Description**: Defines how long the transition to this `PCam` should last in **seconds**. ##### Setter `void` set_tween_duration(`float` duration) **Example**: ```gdscript pcam.set_tween_duration(4.2) ``` ##### Getter `PhantomCameraTween` get_tween_duration() **Example**: ```gdscript pcam.get_tween_duration() ``` #### transition - **Type**: `int` - **Default**: `0` - **Description**: Defines the `Transition` type for the tweening to this `PCam` using the `PhantomCameraTween.TransitionsType` enum. **Transition Types**: - LINEAR (0) - SINE (1) - QUINT (2) - QUART (3) - QUAD (4) - EXPO (5) - ELASTIC (6) - CUBIC (7) - CIRC (8) - BOUNCE (9) - BACK (10) ##### Setter `void` set_tween_transition(`int` transition_type) **Example**: ```gdscript pcam.set_tween_transition(2) # Or using enum value: pcam.set_tween_transition(pcam.PhantomCameraTween.TransitionType.QUINT) ``` ##### Getter `int` get_tween_transition() **Example**: ```gdscript pcam.get_tween_transition() ``` #### ease - **Type**: `int` - **Default**: `2` - **Description**: Defines the `Ease` type for the tweening to this `PCam` using the `PhantomCameraTween.TweenEases` enum. **Ease Types**: - EASE_IN (0) - EASE_OUT (1) - EASE_IN_OUT (2) - EASE_OUT_IN (3) ##### Setter `void` set_tween_ease(`int` ease_type) **Example**: ```gdscript pcam.set_tween_ease(0) # Or using enum value: pcam.set_tween_ease(pcam.PhantomCameraTween.EaseType.EASE_IN) ``` ##### Getter `int` get_tween_ease() **Example**: ```gdscript pcam.get_tween_ease() ``` ``` -------------------------------- ### Get Third Person Rotation in Degrees (GDScript) Source: https://phantom-camera.dev/follow-modes/third-person Retrieves the current third-person rotation in degrees of the SpringArm3D node. Returns a Vector3 value. ```gdscript pcam.get_third_person_rotation_degrees() ``` -------------------------------- ### Get Third Person Rotation in Radians (GDScript) Source: https://phantom-camera.dev/follow-modes/third-person Retrieves the current third-person rotation in radians of the SpringArm3D node. Returns a Vector3 value. ```gdscript pcam.get_third_person_rotation() ``` -------------------------------- ### Set Camera3D Cull Mask (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Illustrates setting the cull_mask for a Camera3D resource. It includes an example of directly setting the mask value and a helper method for enabling/disabling specific layers, which simplifies layer management. ```gdscript # Use this to assign a specific layer value. # Fairly complex to use, so the function below this is recommended. pcam.set_cull_mask(1048575) # Use this helper method to enable or disable a specific layer. pcam.set_cull_mask_value(2, false) ``` -------------------------------- ### Get Third Person Quaternion Rotation (GDScript) Source: https://phantom-camera.dev/follow-modes/third-person Retrieves the current third-person quaternion rotation of the SpringArm3D node. Returns a Quaternion value. ```gdscript pcam.get_third_person_quaternion() ``` -------------------------------- ### Phantom Camera Follow Mode API Source: https://phantom-camera.dev/follow-modes/glued This section covers the core properties related to the Phantom Camera's follow functionality, allowing it to mimic the movement of a target node. ```APIDOC ## SET /api/phantom-camera/follow/target ### Description Sets the target node for the camera to follow. The camera's position will be updated based on the target's movement according to the configured follow mode. ### Method POST ### Endpoint /api/phantom-camera/follow/target #### Request Body - **target_node** (Node2D) - Required - The node that the camera should follow. ### Request Example ```json { "target_node": "player_node" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ## GET /api/phantom-camera/follow/target ### Description Retrieves the currently set follow target node for the camera. ### Method GET ### Endpoint /api/phantom-camera/follow/target ### Response #### Success Response (200) - **target_node** (Node2D) - The node that the camera is currently following. #### Response Example ```json { "target_node": "player_node" } ``` ## SET /api/phantom-camera/follow/damping ### Description Enables or disables the damping effect on the camera's movement. Damping creates a smoother, less abrupt camera motion. ### Method POST ### Endpoint /api/phantom-camera/follow/damping #### Request Body - **enable** (boolean) - Required - Set to `true` to enable damping, `false` to disable. ### Request Example ```json { "enable": true } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ## GET /api/phantom-camera/follow/damping ### Description Retrieves the current state of the follow damping setting. ### Method GET ### Endpoint /api/phantom-camera/follow/damping ### Response #### Success Response (200) - **enable** (boolean) - The current damping state (`true` if enabled, `false` if disabled). #### Response Example ```json { "enable": true } ``` ## SET /api/phantom-camera/follow/damping-value ### Description Sets the damping value for the camera's movement. This value controls the intensity of the damping effect, affecting how quickly the camera catches up to the target. ### Method POST ### Endpoint /api/phantom-camera/follow/damping-value #### Request Body - **damping_value** (Vector2 or Vector3) - Required - The damping value. For 2D, use `Vector2(x, y)`. For 3D, use `Vector3(x, y, z)`. Values typically range from 0 to 1. ### Request Example ```json { "damping_value": {"x": 0.2, "y": 0.2} } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ## GET /api/phantom-camera/follow/damping-value ### Description Retrieves the current damping value applied to the camera's movement. ### Method GET ### Endpoint /api/phantom-camera/follow/damping-value ### Response #### Success Response (200) - **damping_value** (Vector2 or Vector3) - The current damping value. #### Response Example ```json { "damping_value": {"x": 0.2, "y": 0.2} } ``` ``` -------------------------------- ### Set Camera3D Horizontal Offset (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Demonstrates how to set the horizontal offset (h_offset) for a Camera3D resource using GDScript. This allows for fine-tuning the camera's position along the horizontal axis. ```gdscript pcam.set_h_offset(4.2) ``` -------------------------------- ### Get Camera Attributes Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d Retrieves the current camera attributes of the Phantom Camera. This function returns a CameraAttributes object, allowing access to the camera's configuration. ```gdscript pcam.get_attributes() ``` -------------------------------- ### Accessing Base Node2D Properties in C# Source: https://phantom-camera.dev/c-sharp-wrapper Shows how to access properties of the base Node2D class for a Phantom Camera node in C#. Due to the casting mechanism, you need to explicitly reference the Node2D property to modify base node properties like visibility. ```csharp _pcam.Node2D.Visible = false; // Sets the Visible property of the Node2D class to false ``` -------------------------------- ### Set Camera3D Vertical Offset (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Provides a GDScript example for setting the vertical offset (v_offset) of a Camera3D resource. This function is used to adjust the camera's position along the vertical axis. ```gdscript pcam.set_v_offset(4.2) ``` -------------------------------- ### Get Tween Resource for PhantomCameraTweenDirector Source: https://phantom-camera.dev/resource-types/tween-director-resource Retrieves the currently set PhantomCameraTween resource from the TweenDirectorResource. This is used to inspect which tween resource is configured for overrides. ```gdscript pcam_tween_director.get_tween_resource() ``` -------------------------------- ### Get Follow Offset Source: https://phantom-camera.dev/follow-modes/path Retrieves the current follow offset applied to the target's position. This function returns the Vector2 value representing the offset. ```gdscript pcam.get_follow_offset() ``` -------------------------------- ### PhantomCameraNoise2D Properties Source: https://phantom-camera.dev/resource-types/phantom-camera-noise-2d This section details the settable and gettable properties of the PhantomCameraNoise2D resource, including their types, default values, and descriptions. ```APIDOC ## PhantomCameraNoise2D API ### Description This API provides access to the properties of the PhantomCameraNoise2D resource, which controls noise generation for a `Camera2D`. ### Properties #### `amplitude` - **Type**: `float` - **Default**: `10` - **Description**: Defines the size of the noise pattern. Higher values increase the range of the noise. - **Setter**: `void set_amplitude(float value)` - **Getter**: `float get_amplitude()` #### `frequency` - **Type**: `float` - **Default**: `0.5` - **Description**: Sets the density of the noise pattern. Higher values result in more erratic noise. - **Setter**: `void set_frequency(float value)` - **Getter**: `float get_frequency()` #### `randomize_noise_seed` - **Type**: `bool` - **Default**: `true` - **Description**: If true, randomizes the noise pattern each time it runs. If false, `noise_seed` can be used for a fixed pattern. - **Setter**: `void set_randomize_noise_seed(bool value)` - **Getter**: `bool get_randomize_noise_seed()` #### `noise_seed` - **Type**: `int` - **Default**: `0` - **Description**: Sets a predetermined seed for the noise value, useful for achieving a persistent noise pattern. - **Setter**: `void set_noise_seed(int value)` - **Getter**: `int get_noise_seed()` #### `positional_noise` - **Type**: `bool` - **Default**: `true` - **Description**: Enables noise changes to the `Camera2D`'s `offset` position. - **Setter**: `void set_positional_noise(bool value)` - **Getter**: `bool get_positional_noise()` #### `rotational_noise` - **Type**: `bool` - **Default**: `true` - **Description**: Enables noise changes to the `Camera2D`'s rotation. - **Setter**: `void set_rotational_noise(bool value)` - **Getter**: `bool get_rotational_noise()` #### `positional_multiplier_x` - **Type**: `float` - **Default**: `1` - **Description**: Multiplies the positional noise amount on the X-axis. Set to 0 to disable noise on this axis. - **Setter**: `void set_positional_multiplier_x(float value)` - **Getter**: `float get_positional_multiplier_x()` #### `positional_multiplier_y` - **Type**: `float` - **Default**: `1` - **Description**: Multiplies the positional noise amount on the Y-axis. Set to 0 to disable noise on this axis. - **Setter**: `void set_positional_multiplier_y(float value)` - **Getter**: `float get_positional_multiplier_y()` #### `rotational_multiplier` - **Type**: `float` - **Default**: `1` - **Description**: Multiplies the rotational noise amount. - **Setter**: `void set_rotational_multiplier(float value)` - **Getter**: `float get_rotational_multiplier()` ``` -------------------------------- ### Get Limit Target Node for Camera2D Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the NodePath of the currently assigned target node that defines the Camera2D's limits. If no target is set, it returns null. ```gdscript pcsm.get_limit_target() ``` -------------------------------- ### Get Camera3D Keep Aspect Ratio (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Shows how to retrieve the current keep_aspect setting from a Camera3D resource using GDScript. This allows checking the aspect ratio behavior that is currently applied. ```gdscript pcam.get_keep_aspect() ``` -------------------------------- ### PhantomCameraHost Properties Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Properties that configure the behavior and recognition of PCam nodes by the PhantomCameraHost. ```APIDOC ## Properties ### `host_layers` #### Type: `int` #### Default: `1` Determines which `PCam2D` / `PCam3D` nodes this `PCamHost` should recognize. At least one corresponding layer needs to be set on the `PCam` node for the `PCamHost` to recognize it. The layer value uses a bitmask. * * * #### Setter `void` set_host_layers(`int` value) `void` set_host_layers_value(`int` layer, `bool` enabled) Example gdscript ```gdscript ## Bitmask assignment pcam_host.set_host_layers(10) # Enables the 2nd and 4th layer using a bitmask value ## Specific layer change pcam_host.set_host_layers_value(4, true) # Enables the 4th layer ``` #### Getter `int` get_host_layers() Example gdscript ```gdscript pcam_host.get_host_layers() # Returns the layer value as a bitmask ``` ### `interpolation_mode` #### Type: `int` #### Default: `0` Determines whether the `PhantomCamera2D` / `PhantomCamera3D` nodes this `PhantomCameraHost` controls should use physics interpolation or not. | InterpolationMode | Value | Description | |---|---|---| | AUTO | 0 | Automatically detects the physics interpolation based on the active `PCam` | | IDLE | 1 | Forces the camera to only update in the `idle` / `process` ticks | | PHYSICS | 2 | Forces the camera to only update in the `physics` / `physics process` ticks | | MANUAL | 3 | Only updates when the process function is called from the `PCamHost` node. | * * * #### Setter `void` set_interpolation_mode(`int` value) Example gdscript ```gdscript pcam_host.set_interpolation_mode(InterpolationMode.IDLE) ``` #### Getter `int` get_interpolation_mode() Example gdscript ```gdscript pcam_host.get_interpolation_mode() # Returns the current interpolation mode ``` ``` -------------------------------- ### Get Host Layers for PhantomCamera2D (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Retrieves the current host layer configuration for a PhantomCamera2D as a bitmask value. This indicates which PCamHost layers the camera is set to recognize. ```gdscript pcam.get_host_layers() # Returns the layer value as a bitmask ``` -------------------------------- ### Get Noise Decay Time Source: https://phantom-camera.dev/secondary-nodes/phantom-camera-noise-emitter-2d Retrieves the duration in seconds for the noise effect to fully cease. This value impacts the tail-off of the camera shake. Returns a float value. ```gdscript pcam_emitter.get_decay_time() ``` -------------------------------- ### Manage Look At Targets Group in PCam3D (GDScript) Source: https://phantom-camera.dev/look-at-modes/group Demonstrates how to manage the group of targets for the PCam3D's look-at functionality. This includes setting, appending, and erasing targets from the group. It utilizes GDScript and interacts with the PCam3D node. ```gdscript # Assigns a new array of nodes to the Look At Group pcams.set_look_at_targets(targets) # Appends one node to the Look At Group pcams.append_look_at_targets(target) # Appends an array of nodes to the Look At Group pcams.append_look_at_targets_array(targets) # Removes a node from the Look At Group pcams.erase_look_at_targets(target) ``` -------------------------------- ### Manually Process PCamHost (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-host Manually triggers the processing logic for the PCamHost. This method is primarily intended for use when the interpolation mode is set to MANUAL, allowing for explicit control over camera updates. ```gdscript pcam_host.process(delta) ``` -------------------------------- ### Get Follow Path Source: https://phantom-camera.dev/follow-modes/path Retrieves the current follow path associated with the Phantom Camera. This function returns the Vector2 position on the path that the camera is currently closest to. ```gdscript pcam.get_follow_path() ``` -------------------------------- ### Get Up Direction - GDScript Source: https://phantom-camera.dev/look-at-modes/overview Retrieves the current upward direction vector of the Phantom Camera. This value is used to orient the camera, especially when in a look at mode. ```gdscript pcam.get_up() ``` -------------------------------- ### Get PCam3D Tween Duration (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-3d This snippet shows how to retrieve the tween duration for a PCam3D. This value represents how long the camera transition takes and is linked to the PhantomCameraTween resource. ```gdscript var duration = pcam.get_tween_duration() ``` -------------------------------- ### Configure Host Layers for PhantomCamera2D (GDScript) Source: https://phantom-camera.dev/core-nodes/phantom-camera-2d Sets which PCamHost layers a PhantomCamera2D should recognize using bitmask values or specific layer toggles. This determines which hosts the camera can interact with. ```gdscript ## Bitmask assignment pcam.set_host_layers(10) # Enables the 2nd and 4th layer using a bitmask value ## Specific layer change pcam.set_host_layers_value(4, true) # Enables the 4th layer ``` -------------------------------- ### Set Camera3D Projection Type (GDScript) Source: https://phantom-camera.dev/resource-types/camera-3d-resource Demonstrates setting the projection type for a Camera3D resource. It shows using integer values and enum values for PERSPECTIVE, ORTHOGONAL, and FRUSTUM projections. ```gdscript pcam.set_projection(1) # Instead of applying an int directly, # it's also possible to supply an enum value like so: pcam.set_projection(Camera3DResource.ProjectionType.ORTHOGONAL) ``` -------------------------------- ### Get Frequency for PhantomCameraNoise2D in GDScript Source: https://phantom-camera.dev/resource-types/phantom-camera-noise-2d Retrieves the current frequency value of the noise pattern for a PhantomCameraNoise2D. Frequency determines the density of the noise pattern. This function returns a float value. ```gdscript pcam.noise.get_frequency() ```