UWidgetInteractionComponent

Inheritance Hierarchy

Syntax

class UWidgetInteractionComponent : public USceneComponent

Remarks

This is a component to allow interaction with the Widget Component. This class allows you to simulate a sort of laser pointer device, when it hovers over widgets it will send the basic signals to show as if the mouse were moving on top of it. You'll then tell the component to simulate key presses, like Left Mouse, down and up, to simulate a mouse click.

Variables

Name Description

Public variable

UArrowComponent ...

 

ArrowComponent

The arrow component we show at editor time.

Public variable

bool

 

bEnableHitTesting

Should the interaction component perform hit testing (Automatic or Custom) and attempt to simulate hover - if you were going to emulate a keyboard you would want to turn this option off if the virtual keyboard was separate from the virtual pointer device and used a second interaction component.

Protected variable

bool

 

bIsHoveredWidgetFocusable

Are we hovering over any focusable widget?

Protected variable

bool

 

bIsHoveredWidgetHitTestVisible

Are we hovered over a widget that is hit test visible?

Protected variable

bool

 

bIsHoveredWidgetInteractable

Are we hovering over any interactive widgets.

Public variable

bool

 

bShowDebug

Shows some debugging lines and a hit sphere to help you debug interactions.

Protected variable

FHitResult

 

CustomHitResult

Stores the custom hit result set by the player.

Public variable

FLinearColor

 

DebugColor

Determines the color of the debug lines.

Protected variable

UWidgetComponen ...

 

HoveredWidgetComponent

The widget component we're currently hovering over.

Public variable

float

 

InteractionDistance

The distance in game units the component should be able to interact with a widget component.

Public variable

EWidgetInteract ...

 

InteractionSource

Should we project from the world location of the component? If you set this to false, you'll need to call SetCustomHitResult() , and provide the result of a custom hit test form whatever location you wish.

Protected variable

FHitResult

 

LastHitResult

The last hit result we used.

Protected variable

FVector2D

 

LastLocalHitLocation

The last 2D location on the widget component that was hit.

Protected variable

FWeakWidgetPath

 

LastWidgetPath

The last widget path under the hit result.

Protected variable

FVector2D

 

LocalHitLocation

The 2D location on the widget component that was hit.

Protected variable

FModifierKeysSt ...

 

ModifierKeys

The modifier keys to simulate during key presses.

Public variable

FOnHoveredWidge ...

 

OnHoveredWidgetChanged

Called when the hovered Widget Component changes.

Public variable

float

 

PointerIndex

Each user virtual controller or virtual finger tips being simulated should use a different pointer index.

Protected variable

TSet < FKey >

 

PressedKeys

The current set of pressed keys we maintain the state of.

Public variable

TEnumAsByte < EC ...

 

TraceChannel

The trace channel to use when tracing for widget components in the world.

Public variable

int32

 

VirtualUserIndex

Represents the Virtual User Index.

Constructors

Name Description

Public function

UWidgetInteractionComponent

(
    const FObjectInitializer & ObjectIn...
)

Functions

Name Description

Protected function

bool

 

CanInteractWithComponent

(
    UWidgetComponent * Component
)

Returns true if the inteaction component can interact with the supplied widget component

Protected function

bool

 

CanSendInput()

Is it safe for this interaction component to run? Might not be in a server situation with no slate application.

Protected function Virtual

FWidgetPath

 

FindHoveredWidgetPath

(
    const FWidgetTraceResult & TraceRes...
)

Gets the WidgetPath for the widget being hovered over based on the hit result.

Public function

FVector2D

 

Get2DHitLocation()

Gets the last hit location on the widget in 2D, local pixel units of the render target.

Public function

UWidgetCompo ...

 

GetHoveredWidgetComponent()

Get the currently hovered widget component.

Public function

const FWeakW ...

 

GetHoveredWidgetPath()

Gets the widget path for the slate widgets under the last hit result.

Protected function

void

 

GetKeyAndCharCodes

(
    const FKey & Key,
    bool& bHasKeyCode,
    uint32 & KeyCode,
    bool& bHasCharCode,
    uint32 & CharCode
)

Gets the key and char codes for sending keys for the platform.

Public function

const FHitRe ...

 

GetLastHitResult()

Gets the last hit result generated by the component. Returns the custom hit result if that was set.

Protected function

void

 

GetRelatedComponentsToIgnoreInAutomaticHitTesting

(
    TArray < UPrimitiveComponent * >...
)

Gets the list of components to ignore during hit testing.

Public function

bool

 

IsOverFocusableWidget()

Returns true if a widget under the hit result is focusable.

Public function

bool

 

IsOverHitTestVisibleWidget()

Returns true if a widget under the hit result is has a visibility that makes it hit test visible.

Public function

bool

 

IsOverInteractableWidget()

Returns true if a widget under the hit result is interactive.

Protected function Virtual

FWidgetTrace ...

 

PerformTrace()

Performs the trace and gets the hit result under the specified InteractionSource

Public function Virtual

bool

 

PressAndReleaseKey

(
    FKey Key
)

Does both the press and release of a simulated keyboard key.

Public function Virtual

bool

 

PressKey

(
    FKey Key,
    bool bRepeat
)

Press a key as if it had come from the keyboard.

Public function Virtual

void

 

PressPointerKey

(
    FKey Key
)

End UActorComponent .

Public function Virtual

bool

 

ReleaseKey

(
    FKey Key
)

Releases a key as if it had been released by the keyboard.

Public function Virtual

void

 

ReleasePointerKey

(
    FKey Key
)

Releases a key as if the mouse/pointer were the source of it.

Public function Virtual

void

 

ScrollWheel

(
    float ScrollDelta
)

Sends a scroll wheel event to the widget under the last hit result.

Public function Virtual

bool

 

SendKeyChar

(
    FString Characters,
    bool bRepeat
)

Transmits a list of characters to a widget by simulating a OnKeyChar event for each key listed in the string.

Public function

void

 

SetCustomHitResult

(
    const FHitResult & HitResult
)

Set custom hit result.

Protected function

void

 

SimulatePointerMovement()

Performs the simulation of pointer movement. Does not run if bEnableHitTesting is set to false.

Overridden from UActorComponent

Name Description

Public function Virtual

void

 

Activate

(
    bool bReset
)

Activates the SceneComponent

Public function Virtual

void

 

Deactivate()

Deactivates the SceneComponent.

Public function Virtual

void

 

OnComponentCreated()

Begin ActorComponent interface.

Public function Virtual

void

 

TickComponent

(
    float DeltaTime,
    enum ELevelTick TickType,
    FActorComponentTickFunction * T...
)

Function called every frame on this ActorComponent.

Classes

Name

Description

Protected struct

FWidgetTraceResult

References

Module

UMG

Header

Runtime/UMG/Public/Components/WidgetInteractionComponent.h