UUxtManipulatorComponentBase
Base class for manipulation components that react to pointer interactions.
This class does not modify the actor as-is. Implementations should use the provided functions to compute a target transform from grabbing pointers and call the ApplyTargetTransform method to actually modify the actor.
class UUxtManipulatorComponentBase;
Header
#include <Interactions/UxtManipulatorComponentBase.h>
Inheritance
Inherits from UUxtGrabTargetComponent, UUxtManipulatorComponent, IUxtGrabTarget, IUxtGrabHandler, IUxtFarTarget, IUxtFarHandler, UActorComponent
Public Functions
Name | |
---|---|
UUxtManipulatorComponentBase() | |
~UUxtManipulatorComponentBase() | |
void | MoveToTargets(const FTransform & SourceTransform, FTransform & TargetTransform, bool UsePointerRotation) const |
void | RotateAroundPivot(const FTransform & SourceTransform, const FVector & Pivot, FTransform & TargetTransform) const |
void | RotateAboutAxis(const FTransform & SourceTransform, const FVector & Pivot, const FVector & Axis, FTransform & TargetTransform) const |
void | SmoothTransform(const FTransform & SourceTransform, float LocationLerpTime, float RotationLerpTime, float DeltaSeconds, FTransform & TargetTransform) const |
void | SetInitialTransform() |
void | ApplyTargetTransform(const FTransform & TargetTransform) |
USceneComponent * | GetTargetComponent() |
Protected Functions
Name | |
---|---|
virtual void | BeginPlay() override |
virtual void | EndPlay(const EEndPlayReason::Type EndPlayReason) override |
Public Attributes
Name | |
---|---|
FUxtUpdateTransformDelegate | OnUpdateTransform |
FTransform | InitialTransform |
FTransform | InitialCameraSpaceTransform |
bool | bAutoSetInitialTransform |
USceneComponent * | TransformTarget |
Protected Attributes
Name | |
---|---|
UxtManipulationMoveLogic * | MoveLogic |
UxtTwoHandManipulationRotateLogic * | TwoHandRotateLogic |
UxtTwoHandManipulationScaleLogic * | TwoHandScaleLogic |
Additional inherited members
Public Functions inherited from UUxtGrabTargetComponent
Name | |
---|---|
UUxtGrabTargetComponent() | |
void | FindGrabPointer(UUxtNearPointerComponent * NearPointer, UUxtFarPointerComponent * FarPointer, bool & Success, FUxtGrabPointerData & PointerData, int & Index) const |
void | GetPrimaryGrabPointer(bool & Valid, FUxtGrabPointerData & PointerData) const |
void | GetSecondaryGrabPointer(bool & Valid, FUxtGrabPointerData & PointerData) const |
bool | ForceEndGrab() |
FTransform | GetGrabPointCentroid(const FTransform & ToWorldTransform) const |
FVector | GetTargetCentroid() const |
bool | GetTickOnlyWhileGrabbed() const |
void | SetTickOnlyWhileGrabbed(bool bEnable) |
const TArray< FUxtGrabPointerData > & | GetGrabPointers() const |
virtual void | OnExternalManipulationStarted() override |
Protected Functions inherited from UUxtGrabTargetComponent
Public Attributes inherited from UUxtGrabTargetComponent
Name | |
---|---|
FUxtEnterFarFocusDelegate | OnEnterFarFocus |
FUxtUpdateFarFocusDelegate | OnUpdateFarFocus |
FUxtExitFarFocusDelegate | OnExitFarFocus |
FUxtEnterGrabFocusDelegate | OnEnterGrabFocus |
FUxtUpdateGrabFocusDelegate | OnUpdateGrabFocus |
FUxtExitGrabFocusDelegate | OnExitGrabFocus |
FUxtBeginGrabDelegate | OnBeginGrab |
FUxtUpdateGrabDelegate | OnUpdateGrab |
FUxtEndGrabDelegate | OnEndGrab |
int32 | InteractionMode |
int32 | GrabModes |
Public Functions inherited from UUxtManipulatorComponent
Name | |
---|---|
bool | GetAutoDetectConstraints() const |
void | SetAutoDetectConstraints(bool bNewAutoDetectConstraints) |
const TArray< FComponentReference > & | GetSelectedConstraints() const |
void | AddConstraint(const FComponentReference & NewConstraint) |
void | RemoveConstraint(const FComponentReference & NewConstraint) |
bool | GetRelativeToInitialScale() const |
void | SetRelativeToInitialScale(const bool Value) |
float | GetMinScale() const |
void | SetMinScale(const float Value) |
float | GetMaxScale() const |
void | SetMaxScale(const float Value) |
Protected Functions inherited from UUxtManipulatorComponent
Name | |
---|---|
virtual void | TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction * ThisTickFunction) override |
void | InitializeConstraints(USceneComponent * NewTargetComponent) |
void | ApplyConstraints(FTransform & Transform, EUxtTransformMode TransformMode, bool bIsOneHanded, bool bIsNear) const |
Public Functions inherited from IUxtGrabTarget
Name | |
---|---|
bool | IsGrabFocusable(const UPrimitiveComponent * Primitive) const |
Public Functions inherited from IUxtGrabHandler
Name | |
---|---|
bool | CanHandleGrab(UPrimitiveComponent * Primitive) const |
void | OnEnterGrabFocus(UUxtNearPointerComponent * Pointer) |
void | OnUpdateGrabFocus(UUxtNearPointerComponent * Pointer) |
void | OnExitGrabFocus(UUxtNearPointerComponent * Pointer) |
void | OnBeginGrab(UUxtNearPointerComponent * Pointer) |
void | OnUpdateGrab(UUxtNearPointerComponent * Pointer) |
void | OnEndGrab(UUxtNearPointerComponent * Pointer) |
Public Functions inherited from IUxtFarTarget
Name | |
---|---|
bool | IsFarFocusable(const UPrimitiveComponent * Primitive) const |
Public Functions inherited from IUxtFarHandler
Name | |
---|---|
bool | CanHandleFar(UPrimitiveComponent * Primitive) const |
void | OnEnterFarFocus(UUxtFarPointerComponent * Pointer) |
void | OnUpdatedFarFocus(UUxtFarPointerComponent * Pointer) |
void | OnExitFarFocus(UUxtFarPointerComponent * Pointer) |
void | OnFarPressed(UUxtFarPointerComponent * Pointer) |
void | OnFarDragged(UUxtFarPointerComponent * Pointer) |
void | OnFarReleased(UUxtFarPointerComponent * Pointer) |
Public Functions Documentation
function UUxtManipulatorComponentBase
UUxtManipulatorComponentBase()
function ~UUxtManipulatorComponentBase
~UUxtManipulatorComponentBase()
function MoveToTargets
void MoveToTargets(
const FTransform & SourceTransform,
FTransform & TargetTransform,
bool UsePointerRotation
) const
Translate the source transform such that grab points match targets. If more than one pointer is used then the centroid of the grab points and targets is used.
function RotateAroundPivot
void RotateAroundPivot(
const FTransform & SourceTransform,
const FVector & Pivot,
FTransform & TargetTransform
) const
Rotates the source transform around the pivot point such that the pointers line up with current targets. If more than one pointer is used then the resulting rotation will minimize the mean square of target distances.
function RotateAboutAxis
void RotateAboutAxis(
const FTransform & SourceTransform,
const FVector & Pivot,
const FVector & Axis,
FTransform & TargetTransform
) const
Rotates the source transform around the pivot point on the given axis such that the pointers line up with current targets. If more than one pointer is used then the resulting rotation will minimize the mean square of target distances.
function SmoothTransform
void SmoothTransform(
const FTransform & SourceTransform,
float LocationLerpTime,
float RotationLerpTime,
float DeltaSeconds,
FTransform & TargetTransform
) const
Apply a low-pass filter to the source transform location and rotation to smooth out jittering. Target transform is a exponentially weighted average of the current component transform and the source transform based on the time step.
function SetInitialTransform
void SetInitialTransform()
Cache the initial world space and camera space transform. Manipulation should be based on these initial transform for stable results. If bAutoSetInitialTransform is true then the initial transform is updated when grabbed.
function ApplyTargetTransform
void ApplyTargetTransform(
const FTransform & TargetTransform
)
Apply the transform to the actor root scene component. Relative transform between the manipulator component and the root scene component is preserved.
function GetTargetComponent
USceneComponent * GetTargetComponent()
Get the component the manipulator is targeting.
Protected Functions Documentation
function BeginPlay
virtual void BeginPlay() override
Reimplements: UUxtGrabTargetComponent::BeginPlay
function EndPlay
virtual void EndPlay(
const EEndPlayReason::Type EndPlayReason
) override
Public Attributes Documentation
variable OnUpdateTransform
FUxtUpdateTransformDelegate OnUpdateTransform;
variable InitialTransform
FTransform InitialTransform;
variable InitialCameraSpaceTransform
FTransform InitialCameraSpaceTransform;
variable bAutoSetInitialTransform
bool bAutoSetInitialTransform = true;
If true the initial transform will be set automatically when the component is grabbed.
variable TransformTarget
USceneComponent * TransformTarget = nullptr;
The component to transform, will default to the root scene component if not specified
Protected Attributes Documentation
variable MoveLogic
UxtManipulationMoveLogic * MoveLogic;
variable TwoHandRotateLogic
UxtTwoHandManipulationRotateLogic * TwoHandRotateLogic;
variable TwoHandScaleLogic
UxtTwoHandManipulationScaleLogic * TwoHandScaleLogic;
Updated on 19 August 2021 at 17:42:51 Coordinated Universal Time