UViewportWorldInteraction

Choose your operating system:

Windows

macOS

Linux

Inheritance Hierarchy

References

Module

ViewportInteraction

Header

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

Include

#include "ViewportWorldInteraction.h"

Syntax

class UViewportWorldInteraction : public UEditorWorldExtension

Variables

Name Description

Protected variable

bool

 

bDraggedSinceLastSelection

True if we've dragged objects with either hand since the last time we selected something

Protected variable

FTransform

 

LastDragGizmoStartTransform

Gizmo start transform of the last drag we did with either hand.

Protected variable

FTrackingTransa...

 

TrackingTransaction

Undo/redoManages saving undo for selected actors while we're dragging them around

Constructors

Name Description

Public function

UViewportWorldInteraction()

Functions

Name Description

Public function

void

 

AddActorToExcludeFromHitTests

(
    AActor* ActorToExcludeFromHitT...
)

Adds an actor to the list of actors to never allow an interactor to hit in the scene.

Public function

void

 

AddInteractor

(
    UViewportInteractor* Interacto...
)

Adds interactor to the worldinteraction

Public function

void

 

AddMouseCursorInteractor()

Creates an interactor for the mouse cursor.

Public function

void

 

AllowWorldMovement

(
    bool bAllow
)

The ability to move and scale the world

Public function

void

 

ApplyVelocityDamping

(
    FVector& Velocity,
    const bool bVelocitySensitive
)

Given a world space velocity vector, applies inertial damping to it to slow it down

Public function Const

bool

 

AreAligningToActors()

For other systems to check if the Viewport World Interaction system is currently aligning transformables to actors

Public function

void

 

Copy()

Copies selected objects to the clipboard

Public function

void

 

CycleTransformGizmoCoordinateSpace()

Switch which transform gizmo coordinate space we're using.

Public function

void

 

DeleteSelectedObjects()

Deletes all the selected objects

Public function

void

 

Deselect()

Deselects all the current selected objects

Public function

void

 

Duplicate()

Duplicates the selected objects

Public function

bool

 

FindPlacementPointUnderLaser

(
    UViewportInteractor* Interacto...,
    FVector& OutHitLocation
)

Figures out where to place an object when tracing it against the scene using a laser pointer

Public function Const

const TArray...

 

GetActorsToExcludeFromHitTest()

Public function Const

const UViewp...

 

GetAssetContainer()

Gets the container for all the assets of ViewportInteraction.

Public function Const

FLinearColor

 

GetColor

(
    const EColors Color,
    const float Multiplier
)

Gets the color from color type

Public function Const

float

 

GetCurrentDeltaTime()

Gets the current delta time, so functions that don't get the delta time passed can still get it

Public function Const

EGizmoHandle...

 

GetCurrentGizmoType()

Gets the current Gizmo handle type

Public function Const

FEditorViewp...

 

GetDefaultOptionalViewportClient()

Gets the currently used viewport

Public function Const

FTransform

 

GetHeadTransform()

Gets the transform of the viewport / user's HMD in world space

Public function Const

const TArray...

 

GetInteractors()

Gets all the interactors

Public function

float

 

GetMaxScale()

Returns the maximum user scale

Public function

float

 

GetMinScale()

Returns the minimum user scale

Public function Const

int32

 

GetMotionControllerID()

Returns the Unreal controller ID for the motion controllers we're using

Public function Const

FTransform

 

GetRoomSpaceHeadTransform()

Gets the transform of the viewport / user's HMD in room space

Public function Const

FTransform

 

GetRoomTransform()

Gets the world space transform of the calibrated VR room origin.

Public function

FTrackingTra...

 

GetTrackingTransaction()

Gets the tracking transactions

Public function

TArray< TUni...

 

GetTransformables()

Gets a list of all of the objects we're currently interacting with, such as selected actors

Public function Const

const UViewp...

 

GetTransformer()

Public function

ABaseTransfo...

 

GetTransformGizmoActor()

Gets the transform gizmo actor, or returns null if we currently don't have one

Public function Const

ECoordSystem

 

GetTransformGizmoCoordinateSpace()

Returns which transform gizmo coordinate space we're using, world or local

Public function Const

float

 

GetTransformGizmoScale()

Returns the current transform gizmo scale

Public function Const

float

 

GetWorldScaleFactor()

Gets the world scale factor, which can be multiplied by a scale vector to convert to room space

Public function

bool

 

HasCandidatesSelected()

For other systems to check if the Viewport World Interaction system currently has candidate actors selected

Public function Const

bool

 

HaveHeadTransform()

Returns true if we actually are using VR and have a valid head location, meaning a call to GetHeadTransform() is valid

Public function

void

 

InitColors()

Initialize colors

Public function Const

bool

 

IsInteractableComponent

(
    const UActorComponent* Compone...
)

Checks to see if we're allowed to interact with the specified component

Public function Const

bool

 

IsInVR()

Get if this world interaction is in VR.

Public function Const

bool

 

IsOtherInteractorHoveringOverComponent

(
    UViewportInteractor* Interacto...,
    UActorComponent* Component
)

Check if there is another interactor hovering over the component

Public function Const

bool

 

IsTransformGizmoVisible()

Returns whether the transform gizmo is actually visible right now.

Public function Static

const UViewp...

 

LoadAssetContainer()

Static function to load the asset container

Public function

FOnFinishedM...

 

OnFinishedMovingTransformables()

Public function

FOnHandleInp...

 

OnHandleAxisInput()

Public function

FOnHandleInp...

 

OnHandleKeyInput()

Public function

FOnViewportW...

 

OnPostWorldInteractionTick()

Public function

FOnPreviewIn...

 

OnPreviewInputAction()

Public function

FOnViewportW...

 

OnPreWorldInteractionTick()

Public function

FOnStartDrag...

 

OnStartDragging()

Public function

FOnStopDragg...

 

OnStopDragging()

Public function

FOnVIHoverUp...

 

OnViewportInteractionHoverUpdate()

Public function

FOnVIActionH...

 

OnViewportInteractionInputAction()

Public function

FOnViewportI...

 

OnViewportInteractionInputUnhandled()

Public function Virtual

FOnWorldScal...

 

OnWorldScaleChanged()

Public function

void

 

PairInteractors

(
    UViewportInteractor* FirstInte...,
    UViewportInteractor* SecondInt...
)

Pairs to interactors by setting the other interactor for each interactor

Public function

void

 

Paste()

Pastes the clipboard contents into the scene

Public function

void

 

PlaySound

(
    USoundBase* SoundBase,
    const FVector& InWorldLocation,
    const float InVolume
)

Plays sound at location.

Public function

bool

 

PreprocessedInputAxis

(
    const int32 ControllerId,
    const FKey Key,
    const float Delta,
    const float DeltaTime
)

Handles the axis input from the Input Preprocessor

Public function

bool

 

PreprocessedInputKey

(
    const FKey Key,
    const EInputEvent Event
)

Handles the key input from the Input Preprocessor

Public function

void

 

Redo()

Redoes the last change

Public function

void

 

ReleaseMouseCursorInteractor()

When you're finished with the mouse cursor interactor, call this to release it.

Public function

void

 

RemoveInteractor

(
    UViewportInteractor* Interacto...
)

Removes interactor from the worldinteraction and removes the interactor from its paired interactor if any

Public function

void

 

SetDefaultOptionalViewportClient

(
    const TSharedPtr< class FEditorView...
)

When using VR, this sets the viewport client that's been "possessed" by the head mounted display.

Public function

void

 

SetDraggedInteractable

(
    IViewportInteractableInterface*...,
    UViewportInteractor* Interacto...
)

Sets the currently dragged interactavle

Public function

void

 

SetDraggedSinceLastSelection

(
    const bool bNewDraggedSinceLastSele...
)

Sets if objects are dragged with either hand since last time selecting something

Public function

void

 

SetForceCursor

(
    const bool bInShouldForceCursor
)

Public function

void

 

SetGizmoHandleType

(
    const EGizmoHandleTypes InGizmoHand...
)

Sets the current gizmo handle type

Public function

void

 

SetHeadTransform

(
    const FTransform& NewHeadTransform
)

Sets a new transform for the room so that the HMD is aligned to the new transform.

Public function

void

 

SetInVR

(
    const bool bInVR
)

Set if this world interaction is in VR.

Public function

void

 

SetLastDragGizmoStartTransform

(
    const FTransform NewLastDragGizmoSt...
)

Sets the transform of the gizmo when starting drag

Public function

void

 

SetRoomTransform

(
    const FTransform& NewRoomTransform
)

Sets a new transform for the room, in world space.

Public function

void

 

SetRoomTransformForNextFrame

(
    const FTransform& NewRoomTransform
)

Public function

void

 

SetSelectionAsCandidates()

If there are no currently selected candidates, use the currently selected actors as candidates.

Public function

void

 

SetShouldSuppressExistingCursor

(
    const bool bInShouldSuppressCursor
)

Getters and setters for whether or not to show the cursor on the viewport

Public function

void

 

SetTransformables

(
    TArray< TUniquePtr< FViewportTransf...,
    const bool bNewObjectsSelected
)

Sets the list of objects that this system will be responsible for transforming when interacting using the gizmo or directly on the objects

Public function

void

 

SetTransformer

(
    UViewportTransformer* NewTrans...
)

Sets the system that should be used to transform objects in the scene.

Public function

void

 

SetTransformGizmoClass

(
    const TSubclassOf< ABaseTransformGi...
)

Changes the transform gizmo class that it will change to next refresh

Public function

void

 

SetTransformGizmoCoordinateSpace

(
    const ECoordSystem NewCoordSystem
)

Sets which transform gizmo coordinate space is used

Public function

void

 

SetTransformGizmoScale

(
    const float NewScale
)

Sets how large the transform gizmo is

Public function

void

 

SetTransformGizmoVisible

(
    const bool bShouldBeVisible
)

Sets whether the transform gizmo should be visible at all

Public function

void

 

SetUseInputPreprocessor

(
    bool bInUseInputPreprocessor
)

Sets whether we should allow input events from the input preprocessor or not

Public function

void

 

SetWorldToMetersScale

(
    const float NewWorldToMetersScale,
    const bool bCompensateRoomWorldScal...
)

Sets GNewWorldToMetersScale

Public function Const

bool

 

ShouldForceCursor()

Getters and setters for whether or not to show the cursor on the viewport

Public function Const

bool

 

ShouldSuppressExistingCursor()

Getters and setters for whether or not to show the cursor on the viewport

Public function Const

bool

 

ShouldTransformGizmoBeVisible()

Returns whether the transform gizmo should be visible

Public function

void

 

SkipInteractiveWorldMovementThisFrame()

Tells the world interaction system to skip updates of world movement this frame.

Public function

FVector

 

SnapLocation

(
    const bool bLocalSpaceSnapping,
    const FVector& DesiredGizmoLocatio...,
    const FTransform& GizmoStartTransf...,
    const FVector SnapGridBase,
    const bool bShouldConstrainMovement,
    const FVector AlignAxes
)

Public function

void

 

StartDragging

(
    UViewportInteractor* Interacto...,
    UActorComponent* ClickedTransf...,
    const FVector& HitLocation,
    const bool bIsPlacingNewObjects,
    const bool bAllowInterpolationWhenP...,
    const bool bShouldUseLaserImpactDra...,
    const bool bStartTransaction,
    const bool bWithGrabberSphere
)

Starts dragging selected objects around.

Public function

void

 

StopDragging

(
    UViewportInteractor* Interacto...
)

Called to finish a drag action with the specified interactor

Public function

void

 

Undo()

Invokes the editor's undo system to undo the last change

Public function

void

 

UseLegacyInteractions()

Forces the VWI to fall back to standard desktop interactions

Public function

void

 

UseVWInteractions()

Sets the VWI to use its own interactions

Overridden from UEditorWorldExtension

Name Description

Protected function Virtual

void

 

EnteredSimulateInEditor()

Give child class a chance to act on entering simulate mode

Public function Virtual

void

 

Init()

Initialize extension

Public function Virtual

bool

 

InputAxis

(
    FEditorViewportClient* InViewp...,
    FViewport* Viewport,
    int32 ControllerId,
    FKey Key,
    float Delta,
    float DeltaTime
)

Public function Virtual

bool

 

InputKey

(
    FEditorViewportClient* InViewp...,
    FViewport* Viewport,
    FKey Key,
    EInputEvent Event
)

Input

Protected function Virtual

void

 

LeftSimulateInEditor

(
    UWorld* SimulateWorld
)

Give child class a chance to act on leaving simulate mode

Public function Virtual

void

 

Shutdown()

Shut down extension when world is destroyed

Public function Virtual

void

 

Tick

(
    float DeltaSeconds
)

Give base class the chance to tick

Protected function Virtual

void

 

TransitionWorld

(
    UWorld* NewWorld,
    EEditorWorldExtensionTransitionStat...
)

Reparent actors to a new world

Classes

Name

Description

Public class

FOnFinishedMovingTransformables

Gets the event for when the current set of transformables has finally stop moving (after a drag, and all inertial effects or snapping interpolation has completed

Public class

FOnHandleInputAxis

To handle raw axis input from the Input Preprocessor

Public class

FOnHandleInputKey

To handle raw key input from the Input Preprocessor

Public class

FOnPreviewInputAction

Gets the event for previewing input actions.

Public class

FOnStartDragging

Gets the event for when an interactor starts dragging

Public class

FOnStopDragging

Gets the event for when an interactor stops dragging

Public class

FOnVIActionHandle

Gets the event for input actions update which is broadcasted for each interactor

Public class

FOnViewportInteractionInputUnhandled

Called when the user clicks on 'nothing' to allow systems to deselect anything that's selected

Public class

FOnViewportWorldInteractionTick

Public class

FOnVIHoverUpdate

Gets the event for hovering update which is broadcasted for each interactor

Public class

FOnWorldScaleChanged

Enums

Name

Description

Public enum

EColors

Colors

Constants

Name

Description

AssetContainerPath

The path of the asset container