ATPCComponent
The UATPCCameraComponent is the heart of the Advanced Third Person Camera plugin, acting as the central hub for managing all camera-related functionalities. It replaces the standard USpringArmComponent
, offering a far more extensive and customizable set of features to control your third-person camera.
Key Functionalities
Camera Mode Management:
Define Camera Modes: You can define multiple camera modes, each with its unique settings, using
UATPCCameraModeDataAsset
assets. These assets are assigned to the component's CameraModesAssets array.Set Default Mode: The
DefaultCameraModeTag
property determines which camera mode is active by default.Switch Modes Dynamically: The component provides functions to switch between camera modes during gameplay:
SetCameraMode
: Switches to the camera mode identified by the specified GameplayTag. You can control whether the transition is interpolated smoothly or happens instantly.SetCustomCameraMode
: Overrides the current camera mode with a custom UATPCCameraModeDataAsset without changing the actual CurrentCameraModeTag. Useful for temporary mode adjustments.ResetCustomCameraMode
: Restores the previously active camera mode after using SetCustomCameraMode.
Get Current Mode: You can retrieve information about the currently active camera mode:
GetCurrentCameraModeTag
: Returns theGameplayTag
of the current camera mode.GetCurrentCameraMode
: Returns a pointer to theUATPCCameraModeDataAsset
representing the current mode.
Camera Object Management:
Create and Access: The component automatically creates and manages instances of specialized Camera Objects:
UATPCCameraLocationObject
: Handles camera positioning and movement.UATPCCameraFOVObject
: Controls the camera's field of view.UATPCCameraFadingObject
: Manages object fading in front of the camera.UATPCCameraFollowTerrainObject
: Adjusts the camera to follow terrain contours.UATPCCameraShakesObject
: Implements camera shake effects.UATPCCameraLockOnTargetObject
: Handles camera locking onto targets.
Retrieve Objects: You can access these objects using functions like
GetCameraLocationObject
,GetCameraFOVObject
, etc. This allows you to directly interact with their functionalities and customize their behavior further.
Camera Volume Integration:
Detect and Respond: The component automatically detects when the character enters or exits
AATPCCameraVolume
actors placed in the level.Trigger Mode Changes: It triggers camera mode changes based on the volume's configuration, seamlessly transitioning between different camera behaviors.
Zoom Control:
Zoom In/Out: Functions like
ZoomIn
andZoomOut
provide convenient ways to adjust the camera distance.Set Distance: The
SetCameraDistance
function lets you set a specific camera distance, with the option to interpolate the change.Get Distance: The
GetCameraDistance
function retrieves the current camera distance.
Debugging and Visualization:
Debug Rules: The DebugRules structure allows you to enable various debugging features, such as:
bEnableLocationObjectDebug
: Prints information about the camera's position and movement.bEnableRoofCollisionCheckDebug
: Shows debug information related to roof collision checks.bEnableDrawFadeShapeDebug
: Visualizes the shape used for object fading.bFollowTerrainEnableDebug
: Prints debug information about terrain following.bEnableLockOnTargetDebug
: Shows debug information about lock-on targeting, including the aiming cone.bLockOnTargetShowTargetDebug
: Highlights the currently locked target in the scene.
Additional Functions
Besides the core functionalities described above, UATPCCameraComponent
offers several other functions for more specialized tasks:
ValidateComponents
: Validates the settings of all Camera Objects, ensuring they are consistent with the current camera mode. Useful after making runtime changes to camera parameters.FindOverlapCameraVolume
: Returns a pointer to the currently overlapping AATPCCameraVolume, if any.GetCameraLocation
: Returns the camera's current world location.GetCameraRotation
: Returns the camera's current world rotation.IsSettingInitialCameraMode
: Returns true if the component is currently setting the initial camera mode, which happens during the component's initialization.GetOwningPawn
: Returns a pointer to the pawn this component is attached to.GetPlayerController
: Returns a pointer to the player controller controlling the pawn, if any.GetPlayerCameraManager
: Returns a pointer to the player camera manager associated with the player controller.
By understanding the comprehensive capabilities of UATPCCameraComponent and its associated Camera Objects, you can master the art of third-person camera control in Unreal Engine. Craft immersive and dynamic camera experiences, seamlessly blending different behaviors, and extending functionality with custom logic to match your unique vision.
Last updated
Was this helpful?