Skip to content

2.3 Extensions

J1blCblu edited this page Oct 31, 2023 · 6 revisions

Note It's assumed that you've already read the LockOnTargetComponent Overview.

General Overview

LockOnTargetExtensionBase is a base abstract class that can be extended to add optional features to the owning LockOnTargetComponent.

image

Method Description
Initialize()
Deinitialize()
Extension lifetime.
Update() Basic Tick method.
OnTargetLocked()
OnTargetUnlocked()
OnSocketChanged()
OnTargetNotFound()
LockOnTargetComponent callbacks.

Controller Rotation Extension

The corresponding header file: LockOnTargetExtensions/ControllerRotationExtension.h

image

ControllerRotationExtension smoothly orients the owning Controller rotation to face the Target.
Designed for a vertically aligned player representation, just like ACharacter.

Location Prediction

Tries to approximately predict the Target location using velocity.
Adds additional smoothness with fast Targets and helps to achieve 'lag-free' rotation.

Prediction

The purple sphere indicates the final location for the rotation calculation.

Oscillation Smoothing

Smoothies the Target oscillations in Actor's relative location using critically damped spring interpolation.

Smoothing

The purple sphere indicates the final location for the rotation calculation.

Pawn Rotation Extension

The corresponding header file: LockOnTargetExtensions/PawnRotationExtension.h

image

Smoothly orients the owning APawn to face the Target using UPawnMovementComponent.
The rotation speed can be adjusted using RotationRate, similar to how UCharacterMovementComponent does it.

Widget Extension

The corresponding header file: LockOnTargetExtensions/WidgetExtension.h

image

Visually indicates the captured Target by attaching a widget to the Socket.
Uses WidgetComponent internally.

image

UTargetComponent::bWantsDisplayWidget can be used to disable indication for a specific Target.

Targets can have their own widgets.

Camera Modifier Extension

The corresponding header file: LockOnTargetExtensions/CameraModifierExtension.h

image

Adds the specified camera modifier to the PlayerCameraManager.
The camera modifier will be enabled while any Target is locked, and disabled otherwise.

For more info refer to the official documentation.

LockOnTarget provides the ULockOnTargetCameraModifier_Zoom camera modifier that smoothly changes the camera FOV.

Target Preview Extension

The corresponding header file: LockOnTargetExtensions/TargetPreviewExtension.h

image

Tries to predictively find a new Target and mark it.

TargetPreview

Clone this wiki locally