UViewportInteractor

Represents the interactor in the world

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

ViewportInteraction

Header

/Engine/Source/Editor/ViewportInteraction/Public/ViewportInteractor.h

Include

#include "ViewportInteractor.h"

Syntax

class UViewportInteractor : public UObject

Remarks

Represents the interactor in the world

Variables

Name Description

Protected variable

bool

 

bAllowGrabberSphere

True if this interactor supports 'grabber sphere' interaction. Usually disabled for mouse cursors

Protected variable

bool

 

bCanCarry

True if this interactor can 'carry' objects in VR, that is, translation and rotation of the interactor is inherited by the object, instead of just translation

Protected variable

FViewportIntera...

 

InteractorData

All the private data for the interactor

Protected variable

TMap< FKey, FVi...

 

KeyToActionMap

Mapping of raw keys to actions

Protected variable

TObjectPtr< UVi...

 

OtherInteractor

The paired interactor by the world interaction

Protected variable

TOptional< FHit...

 

SavedHitResult

Store the last hitresult from the laser, to use that when calling GetHitResultFromLaserPointer multiple times in a tick.

Protected variable

TOptional< EHit...

 

SavedHitResultFilterMode

Store the last hitresult from the laser, to use that when calling GetHitResultFromLaserPointer multiple times in a tick.

Protected variable

TOptional< FVec...

 

SavedLaserPointerEnd

Store end of the laser pointer.

Protected variable

TObjectPtr< cla...

 

WorldInteraction

The owning world interaction

Constructors

Name Description

Public function

UViewportInteractor()

Default constructor

Functions

Name Description

Public function

void

 

AddKeyAction

(
    const FKey& Key,
    const FViewportActionKeyInput& Act...
)

Adds a new action to the KeyToActionMap

Protected function Virtual Const

bool

 

AllowLaserSmoothing()

If this interactors allows to smooth the laser. Default is true.

Public function Virtual

void

 

CalculateDragRay

(
    float& InOutDragRayLength,
    float& InOutDragRayVelocity
)

Needs to be implemented by the base to calculate drag ray length and the velocity for the ray

Public function Const

bool

 

CanCarry()

Gets if the interactor can carry an object

Public function

FViewportAct...

 

GetActionWithName

(
    const FName InActionName
)

Gets a certain action by iterating through the map looking for the same ActionType

Public function Const

EViewportInt...

 

GetDraggingMode()

Gets the current interactor data dragging mode

Public function Const

float

 

GetDragHapticFeedbackStrength()

Gets the drag haptic feedback strength console variable

Public function Const

FVector

 

GetDragTranslationVelocity()

Gets the interactor data drag velocity

Public function

bool

 

GetGrabberSphere

(
    FSphere& OutGrabberSphere,
    const bool bEvenIfBlocked
)

Gets a sphere on this interactor that can be used to interact with objects in close proximity

Public function Virtual

FHitResult

 

GetHitResultFromLaserPointer

(
    TArray< AActor* >* Option...,
    const EHitResultGizmoFilterMode Giz...,
    TArray< UClass* >* Object...,
    const bool bEvenIfBlocked,
    const float LaserLengthOverride
)

Traces along the laser pointer vector and returns what it first hits in the world

Public function Const

EHitResultGi...

 

GetHitResultGizmoFilterMode()

Gets current gizmo filter mode used for Interaction

Public function

FVector

 

GetHoverLocation()

Gets the interactor laser hover location

Public function

FViewportInt...

 

GetInteractorData()

Gets the private data for this interactor

Public function Const

const FViewp...

 

GetInteractorData()

Gets the private data for this interactor (const)

Public function Virtual Const

bool

 

GetIsLaserBlocked()

To be overridden by base class.

Public function

bool

 

GetLaserPointer

(
    FVector& LaserPointerStart,
    FVector& LaserPointerEnd,
    const bool bEvenIfBlocked,
    const float LaserLengthOverride
)

Gets the start and end point of the laser pointer for the specified hand

Public function Const

float

 

GetLaserPointerMaxLength()

Gets the maximum length of a laser pointer

Public function Const

EViewportInt...

 

GetLastDraggingMode()

Gets the interactor data previous dragging mode

Public function Virtual

UActorCompon...

 

GetLastHoverComponent()

Gets the last component hovered on by the interactor laser.

Public function Const

FTransform

 

GetLastRoomSpaceTransform()

Gets the last hand transform of the interactor, in the local tracking space

Public function Const

FTransform

 

GetLastTransform()

Gets the last world transform of this interactor

Public function Const

UViewportInt...

 

GetOtherInteractor()

Gets the paired interactor assigned by the world interaction, can return null when there is no other interactor

Public function Const

FTransform

 

GetRoomSpaceTransform()

Gets the hand transform of the interactor, in the local tracking space

Public function Const

FTransform

 

GetTransform()

Gets the world transform of this interactor

Public function Virtual Const

bool

 

GetTransformAndForwardVector

(
    FTransform& OutHandTransform,
    FVector& OutForwardVector
)

Creates a hand transform and forward vector for a laser pointer for a given hand

Public function Const

UViewportWor...

 

GetWorldInteraction()

Gets the world interaction

Protected function Virtual

void

 

HandleInputAxis

(
    FEditorViewportClient& ViewportCli...,
    FViewportActionKeyInput& Action,
    const FKey Key,
    const float Delta,
    const float DeltaTime,
    bool& bOutWasHandled
)

To be overridden. Called by HandleInputAxis before delegates and default input implementation

Public function

bool

 

HandleInputAxis

(
    FEditorViewportClient& ViewportCli...,
    const FKey Key,
    const float Delta,
    const float DeltaTime
)

Handles axis input and translates it to actions C++ Child classes are expected to to call there super versions of this.

Protected function

void

 

HandleInputAxis_BP

(
    const FViewportActionKeyInput& Act...,
    const FKey Key,
    const float Delta,
    const float DeltaTime,
    bool& bOutWasHandled
)

To be overridden. Called by HandleInputAxis before delegates and default input implementation

Protected function Virtual

void

 

HandleInputKey

(
    FEditorViewportClient& ViewportCli...,
    FViewportActionKeyInput& Action,
    const FKey Key,
    const EInputEvent Event,
    bool& bOutWasHandled
)

To be overridden. Called by HandleInputKey before delegates and default input implementation

Public function

bool

 

HandleInputKey

(
    FEditorViewportClient& ViewportCli...,
    const FKey Key,
    const EInputEvent Event
)

Handles key input and translates it actions C++ Child classes are expected to to call there super versions of this.

Protected function

void

 

HandleInputKey_BP

(
    const FViewportActionKeyInput& Act...,
    const FKey Key,
    const EInputEvent Event,
    bool& bOutWasHandled
)

To be overridden. Called by HandleInputKey before delegates and default input implementation

Public function Const

bool

 

IsHovering()

If the interactor laser is currently hovering

Public function Const

bool

 

IsHoveringOverGizmo()

If the interactor laser is currently hovering over a gizmo handle

Public function Const

bool

 

IsHoveringOverPriorityType()

If this interactor is hovering over a type that has priority from GetHitResultFromLaserPointer

Public function Const

bool

 

IsHoveringOverSelectedActor()

Returns true if currently hovering over selected actor

Public function Virtual Const

bool

 

IsModifierPressed()

Public function Virtual

void

 

OnStartDragging

(
    const FVector& HitLocation,
    const bool bIsPlacingNewObjects
)

Called by StartDragging in world interaction to give the interactor a chance of acting upon starting a drag operation

Public function Virtual

void

 

PlayHapticEffect

(
    const float Strength
)

Triggers a force feedback effect on device if possible

Public function Virtual

void

 

PollInput()

Base classes need to implement getting the input for the input devices for that interactor

Protected function Virtual

void

 

PreviewInputAxis

(
    FEditorViewportClient& ViewportCli...,
    FViewportActionKeyInput& Action,
    const FKey Key,
    const float Delta,
    const float DeltaTime,
    bool& bOutWasHandled
)

To be overridden. Called by HandleInputAxis before delegates and default input implementation

Protected function Virtual

void

 

PreviewInputKey

(
    FEditorViewportClient& ViewportCli...,
    FViewportActionKeyInput& Action,
    const FKey Key,
    const EInputEvent Event,
    bool& bOutWasHandled
)

To be overridden. Called by HandleInputKey before delegates and default input implementation

Public function

void

 

RemoveKeyAction

(
    const FKey& Key
)

Removes an action from the KeyToActionMap

Public function

void

 

RemoveOtherInteractor()

Removes the other interactor reference for this interactor

Public function Virtual

void

 

ResetHoverState()

Reset the values before checking the hover actions

Public function

void

 

ResetLaserEnd()

Reset the stored laser end location at the end of tick

Public function

void

 

SetCanCarry

(
    const bool bInCanCarry
)

Sets if the interactor can carry an object

Public function

void

 

SetDraggingMode

(
    const EViewportInteractionDraggingM...
)

Sets the current dragging mode for this interactor

Public function

void

 

SetHitResultGizmoFilterMode

(
    EHitResultGizmoFilterMode newFilter
)

Sets the current gizmo filter mode used for Interaction

Public function

void

 

SetHoverLocation

(
    const FVector& InHoverLocation
)

Sets the hover location

Public function

void

 

SetOtherInteractor

(
    UViewportInteractor* InOtherIn...
)

Sets the other interactor

Public function

void

 

SetWorldInteraction

(
    UViewportWorldInteraction* InW...
)

Sets the world interaction

Public function

void

 

Shutdown()

Whenever the ViewportWorldInteraction is shut down, the interacts will shut down as well

Public function

void

 

Tick

(
    const float DeltaTime
)

Update for this interactor called by the ViewportWorldInteraction

Deprecated Functions

Name Description

Public function Virtual

FHitResult

 

GetHitResultFromLaserPointer

(
    TArray< AActor* >* Option...,
    const bool bIgnoreGizmos,
    TArray< UClass* >* Object...,
    const bool bEvenIfBlocked,
    const float LaserLengthOverride
)

bool bIgnoreGizmos replaced with EHitResultGizmoFilterMode GizmoFilterMode