UUxtFollowComponent
The follow component has three different constraints that keeps its owner in front of the camera: Angular Clamp, Distance Clamp, and Orientation. The combination of Angular and Distance Clamp creates a frustum in front of the camera where its owner can be. If its owner is outside that frustum it is adjusted.
Angular Clamp: The objective of this constraint is to ensure that the reference forward vector remains within the bounds set by the leashing parameters. To do this, determine the angles between toTarget and the leashing bounds about the global Z-axis and the reference's Y-axis. If the toTarget falls within the leashing bounds, then we don't have to modify it. Otherwise, we apply a correction rotation to bring it within bounds. This will ensure that the its owner stays within the top, bottom, right and left planes of the frustum.
Distance Clamp: The objective of this constraint is to ensure that the following actor stays within bounds set by the distance parameters. To do this, we measure the current distance from the camera to the its owner. If the distance is within the MinimumDistance and MaximumDistance then we don't have to modify it. Otherwise, we push away or pull in the its owner along the reference forward vector. This will ensure that the its owner stays within the near and far planes of the frustum.
Orientation: The two options provided are constant FaceCamera or WorldLock. While world locked there are three conditions that will cause the its owner to face the camera: Angular Clamps Distance Clamps The angle between the forward vector of the its owner and toTarget vector (vector between the camera and the its owner) is larger than dead zone angle parameter
class UUxtFollowComponent;
Header
#include <Behaviors/UxtFollowComponent.h>
Inheritance
Inherits from UActorComponent
Public Functions
Name | |
---|---|
UUxtFollowComponent() | |
void | Recenter() |
Protected Functions
Name | |
---|---|
virtual void | BeginPlay() override |
virtual void | TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override |
Public Attributes
Name | |
---|---|
AActor * | ActorToFollow |
TEnumAsByte< EUxtFollowOrientBehavior > | OrientationType |
float | OrientToCameraDeadzoneDegrees |
bool | bIgnoreDistanceClamp |
float | MinimumDistance |
float | MaximumDistance |
float | DefaultDistance |
float | VerticalMaxDistance |
bool | bUseFixedVerticalOffset |
bool | bIgnoreAngleClamp |
float | MaxViewHorizontalDegrees |
float | MaxViewVerticalDegrees |
bool | bIgnoreCameraPitchAndRoll |
bool | bInterpolatePose |
float | LerpTime |
float | FixedVerticalOffset |
float | PitchOffset |
Public Functions Documentation
function UUxtFollowComponent
UUxtFollowComponent()
function Recenter
void Recenter()
Force the owner to recenter in the camera's field of view.
Protected Functions Documentation
function BeginPlay
virtual void BeginPlay() override
function TickComponent
virtual void TickComponent(
float DeltaTime,
ELevelTick TickType,
FActorComponentTickFunction * ThisTickFunction
) override
Public Attributes Documentation
variable ActorToFollow
AActor * ActorToFollow;
Actor that this component will follow. If null, this component will follow the camera
variable OrientationType
TEnumAsByte< EUxtFollowOrientBehavior > OrientationType = EUxtFollowOrientBehavior::WorldLock;
Orientation Type
variable OrientToCameraDeadzoneDegrees
float OrientToCameraDeadzoneDegrees = 60.0f;
The owner will not reorient until the angle between its forward vector and the vector to the camera is greater than this value
variable bIgnoreDistanceClamp
bool bIgnoreDistanceClamp = false;
Option to ignore distance clamping
variable MinimumDistance
float MinimumDistance = 50.0f;
Min distance from eye to position its owner around, i.e. the sphere radius
variable MaximumDistance
float MaximumDistance = 100.0f;
Max distance from eye to its owner
variable DefaultDistance
float DefaultDistance = 75.0f;
Default distance from eye to position its owner around, i.e. the sphere radius
variable VerticalMaxDistance
float VerticalMaxDistance = 0.0f;
Max vertical distance between the owner and camera
variable bUseFixedVerticalOffset
bool bUseFixedVerticalOffset = false;
Ignore vertical movement and lock the Y position of the object.
variable bIgnoreAngleClamp
bool bIgnoreAngleClamp = false;
Option to ignore angle clamping
variable MaxViewHorizontalDegrees
float MaxViewHorizontalDegrees = 30.0f;
The horizontal angle from the camera forward axis to the owner will not exceed this value
variable MaxViewVerticalDegrees
float MaxViewVerticalDegrees = 30.0f;
The vertical angle from the camera forward axis to the owner will not exceed this value
variable bIgnoreCameraPitchAndRoll
bool bIgnoreCameraPitchAndRoll = false;
Option to ignore the pitch and roll of the camera
variable bInterpolatePose
bool bInterpolatePose = true;
Option to ignore interpolation between follow poses
variable LerpTime
float LerpTime = 0.1f;
Rate at which its owner will move toward default distance when angular leashing
variable FixedVerticalOffset
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="UxtFollow", meta=(EditCondition="bUseFixedVerticalOffset", EditConditionHides))
float FixedVerticalOffset = 0.0f;
Fixed vertical position offset distance.
variable PitchOffset
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="UxtFollow", meta=(EditCondition="bIgnoreCameraPitchAndRoll && !bIgnoreAngleClamp && !bUseFixedVerticalOffset", EditConditionHides))
float PitchOffset = 0.0f;
Pitch offset from camera (relative to Max Distance)
Updated on 19 August 2021 at 17:42:51 Coordinated Universal Time