ULimenDynamicDepthOfFieldComponent
Overview
ULimenDynamicDepthOfFieldComponent is an actor component that dynamically adjusts the depth of field effect in Unreal Engine 5. It calculates the focal distance based on the camera's line trace and applies this to the active camera's post-process settings. This component can be spawned in Blueprints or C++.
Properties
Type | Name | Access | Description |
|---|---|---|---|
| LineTraceChannel | EditDefaultsOnly | The collision channel used for the line trace to determine the focal distance. |
| bTraceIgnoresOwner | EditDefaultsOnly | Whether the line trace should ignore the component's owner. |
Functions
Return Type | Signature | Description |
|---|---|---|
| BeginPlay() | Initializes the component, retrieves all camera components attached to the owner, and sets up event bindings for camera activation changes. |
| TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) | Updates the depth of field effect based on the active camera's view target and line trace distance. |
| Activate(bool bReset) | Activates the component and updates the post-process settings to enable dynamic depth of field. |
| Deactivate() | Deactivates the component and resets the post-process settings for depth of field. |
| GetLookAtDistance() const | Calculates the focal distance by performing a line trace from the active camera's location in the direction of its forward vector. |
| ActiveCameraChanged(UActorComponent* Component, bool bReset) | Handles changes to the active camera component, updating the post-process settings accordingly. |
| IsAnyCameraViewTarget() const | Checks if any player controller is currently viewing the owner of this component. |
Usage & Implementation Notes
Threading Constraints: This component operates on the game thread and should not be accessed from other threads.
Replication Requirements: None.
Memory Lifetime Management: The component manages its own memory, and it does not require special handling for memory lifetime management.
Initialization Dependencies: The component depends on having camera components attached to its owner. It will deactivate if no cameras are found during
BeginPlay().