Skip to content

GASTask_TargetLock

Floyd edited this page Mar 20, 2025 · 7 revisions

FSTRUCT_TargetLockData

USTRUCT Specifier: BlueprintType

This struct is used for the UGASAbility_TargetLock and the UGASTask_TargetLock to have the same data to work with. Changing this struct will therefore add the changes to both the ability and the task.

Public Member

Identifier UPROPERTY Initializer Description
float MaxAngleToTarget EditAnywhere,
BlueprintReadWrite,
meta=(Units="Deg")
40 Angle in Degrees. The angle the rotation should not overstep
float AngleToStartLerp EditAnywhere,
BlueprintReadWrite,
meta=(Units="Deg")
15 The angle at which the camera will start to rotate back towards the target.
float RotateSpeed EditAnywhere,
BlueprintReadWrite
4 Rotate Speed. 1 means it takes ~1 second to reach the desired rotation. Higher Values = Faster Rotation. Beware that very high values may result in overshooting because this value directly multiplies the value that gets added to the pitch/yaw
float HardRotateSpeedMultiplier EditAnywhere,
BlueprintReadWrite
10 This ignores "RotateSpeed" by default. X < 1 makes it slower, X > 1 makes it faster. Beware that very high values may result in overshooting because this value directly multiplies the value that gets added to the pitch/yaw
float MaxDistanceToStartTargetLock EditAnywhere,
BlueprintReadWrite,
meta=(Units="cm")
1500 How far away a unit is allowed to be eligible for target locking to be applied. This is measured in unreal units / cm.
bool DoLineOfSightCheck EditAnywhere,
BlueprintReadWrite
false Should we do a LineOfSight Check when we find our target for the first time?
bool ContinuousLineOfSightCheck EditAnywhere,
BlueprintReadWrite
false Should we continuously check if the target is still in Line of Sight?
TArray< TSubclassOf< AActor>> LockableClasses EditAnywhere,
BlueprintReadWrite
The classes that are allowed to be locked onto.
TSubclassOf< AActor>> TargetLockVisualizeActorClass EditAnywhere,
BlueprintReadWrite
The actor classes that gets spawned and attached to the target to have a visual indicator that that actor is the target of the ability.

UGASTask_TargetLock

Inherits: UGASTask_EndingAbilityTask
UCLASS Specifier: Blueprintable, BlueprintType, Category="GAS|Tasks"

This is the Gameplay Ability Task that is being run by GASAbility_TargetLock

Members

Type Identifier UPROPERTY Description
TObjectPtr< UCameraComponent> CameraComponent BlueprintReadOnly,
meta=( ExposeOnSpawn="true"),
Category = "GAS | Target Locking Task"
The camera that gets rotated towards the "CameraLockTarget"
FStruct_TargetLockData Configuration EditAnywhere,
BlueprintReadWrite,
Category = "GAS | Target Locking Task"
The config of the task. This has all information and is created by abilities and used as simple way to transfer the information.
TObjectPtr< AActor> CameraLockTarget VisibleAnywhere,
BlueprintReadWrite,
Category = "GAS | Target Locking Task"
The target we want to keep in the center of the camera.
AActor* TargetLockVisualizeActor BlueprintReadWrite,
EditAnywhere,
Category = "Ability | Target Lock"
The spawned actor that may get spawned as a visual guideline for what target is currently targeted

Methods

Type Name UFUNCTION Description
public
static
UGASTask_TargetLock*
StartTargetLock(
UGameplayAbility* OwningAbility,
FName TaskInstanceName,
FStruct_TargetLockData TaskData,
AActor* OptionalOwningActor = nullptr,
UCameraComponent* OptionalCamera= nullptr)
BlueprintCallable,
Category = "Ability|Tasks",
meta = (
HidePin = "OwningAbility",
DefaultToSelf = "OwningAbility",
BlueprintInternalUseOnly = "True")
Static creation of task
protected
void
SetupTargetLock(
UCameraComponent* OptionalCam = nullptr,
AActor* OptionalOwner = nullptr)
- Setup the data for the target lock. Tries to find the owning cam if "OptionalCam" is null. Uses the owner of the ability if "OptionalOwner" is null. Tries to find a target who is of type "Configuration.LockableClass".
protected
void
LerpTargetLocked(
double DeltaTime)
- Rotates the camera towards the required rotation. Uses DeltaTime for smoothness.
protected
bool
IsLockingOnTarget() BlueprintCallable,
Category = "GAS | Target Locking Task"
Returns true if locking onto a target

Clone this wiki locally