---
title: AFM_WidgetInteraction
product: Advanced Framework Pro
version: 1.0
engine: Unreal Engine 5.8
updated: 2026-10-05
canonical: https://docs.human-codeable.com/plugins/afm-widgetinteraction.html
---

Module

# AFM_WidgetInteraction

Wraps Unreal's widget interaction with pointer index management, a cursor and a laser material, so several pointers can drive UMG at once.

#### What it gives you

- Multiple simultaneous UMG pointers
- A themed cursor and beam
- Scroll and press forwarding from any ability

#### Requires

None

#### Required by

None

4 assets24 API members

## Description

Unreal's widget interaction component assumes one pointer. In VR there are at least two hands, and in multiplayer several players may drive the same replicated UI. `AFM_WidgetInteraction` adds pointer index management so each pointer gets a unique index and they do not interfere.

`BP_Helper_WidgetInteraction` provides the visible cursor and beam, and forwards presses, releases and scroll input attributed to the Source Info that triggered them.

## Setup

1. Enable `AFM_WidgetInteraction`.
2. Add `BPC_WidgetInteraction` to the ability that should drive UI, or use the helper actor.
3. Set **Trace Distance** and **Auto Press On Contact** to suit pointing or direct touch.

## Usage

### Pointing at UI

Pair with the laser ability. The laser supplies direction; this component supplies the UMG events.

### Touching UI directly

Set **Auto Press On Contact** true for finger-touch UI, so no button press is required.

### Getting a pointer index

Call `WidgetInteraction_GetFreePointerIndex` once per pointer.

![Two hands driving one interface at once](../images/AFM_WidgetInteraction_result.png)

Two hands driving one interface at once

## Key properties

| Property | When to change |
|---|---|
| `Trace Distance` | Pointer reach |
| `Auto Press On Contact` | Direct-touch UI rather than pointing |
| `Sound Press` | Feedback on press |

## Extending

Derive from `BP_Helper_WidgetInteraction` for a custom cursor or beam.

## Example map

Used throughout `Map_Examples_UI`.

## Troubleshooting

**Two pointers fight over the same widget.** Both are using the same pointer index — obtain each from `WidgetInteraction_GetFreePointerIndex`.

## API reference

Every blueprint asset in this plugin. Expand an asset to see its members.

### Components

**BPC_WidgetInteraction**10 members

extends `SceneComponent`

Component giving its owner a UMG pointer of its own: while active it spawns the widget interaction helper, which draws the beam and the cursor and forwards presses, releases and scrolling to whatever widget the trace lands on. Add it to an actor that has to work widgets without being a motion controller; the laser and the hand abilities carry their own instead.

| Kind | Name | Signature | Description |
|---|---|---|---|
| var | `Trace Distance`Settings | `float` | How far the pointer reaches when looking for a widget to interact with. |
| var | `Auto Press on Contact`Settings | `bool` | Presses automatically when the pointer touches a widget, instead of waiting for an input. Use for direct-touch UI. |
| var | `Sound Press`Sound | `SoundBase` | Sound played when the pointer presses a widget. |
| fn | `UpdateSourceInfo`Source Info | `(SourceInfo: ST_SourceInfo)` | Records which ability is driving this pointer, so the widget can tell which hand or player is interacting. |
| fn | `ScrollInput`Input | `(ScrollDelta: float)` | Sends a scroll wheel delta to the hovered widget. |
| fn | `PressMouseButton`Input | `()` | Presses the simulated mouse button on the hovered widget. |
| fn | `ReleaseMouseButton`Input | `()` | Releases the simulated mouse button on the hovered widget. |
| fn | `IsHoveringWidget`State | `(out HoveringWidget: bool)` | Returns whether the pointer is currently over an interactive widget. |
| event | `UpdateColor` | `(Color: LinearColor)` | Changes the pointer and cursor colour, for example to match the current interaction state. |
| event | `OnWidgetHoveredChanged_Event` | `()` | Internal handler fired when the hovered widget changes. |

### Helper

**BP_Helper_PointerIndexCounter**1 members

extends `ActorComponent`

Counter handing out a fresh pointer index each time it is asked, kept on the game state so every widget interaction in the session ends up with a distinct one. Internal: call Widget Interaction Get Free Pointer Index on the function library, which adds the counter the first time one is needed.

| Kind | Name | Signature | Description |
|---|---|---|---|
| fn | `getFreePointerIndex` | `(out IndexCounter: int)` | Returns an unused pointer index, so multiple simultaneous pointers do not collide in UMG. |

**BP_Helper_WidgetInteraction**12 members

extends `Actor`

World-side actor driving a UMG widget from a trace: it owns the widget interaction component, the cursor plane drawn on the widget's surface and the short spline reaching out to it, interpolating the cursor between hits so it glides rather than jumps. Spawned by the widget interaction component or by a hand ability, never placed.

| Kind | Name | Signature | Description |
|---|---|---|---|
| var | `Scale`Style | `float` | Size multiplier for the cursor and laser visuals. |
| var | `Color`Style | `LinearColor` | Colour of the cursor and laser. |
| var | `Sound Press`Sound | `SoundBase` | Sound played when this pointer presses a widget. |
| fn | `IsHoveringWidget` | `() → bool` | Returns whether this pointer is currently over an interactive widget. |
| event | `PressMouseButton` | `(SourceInfo: ST_SourceInfo)` | Presses on the hovered widget, attributed to the given Source Info. |
| event | `ReleaseMouseButton` | `(SourceInfo: ST_SourceInfo)` | Releases on the hovered widget, attributed to the given Source Info. |
| event | `ShowCursor` | `(Show: bool)` | Shows or hides the pointer cursor without deactivating the pointer. |
| event | `Deactivate` | `(DestroyAfterFadeOut: bool)` | Fades the pointer out, optionally destroying the helper afterwards. |
| event | `Activate` | `()` | Fades the pointer in and starts tracing for widgets. |
| event | `ScrollWheelInput` | `(SourceInfo: ST_SourceInfo, ScrollDelta: float)` | Sends a scroll delta to the hovered widget, attributed to the given Source Info. |
| event | `SetEndLocation` | `(TargetEndLocation: Vector)` | Sets where the laser terminates, so it stops at the widget surface rather than passing through. |
| event | `SetCurrentTrace` | `(CurrentTrace: HitResult)` | Supplies the trace result the pointer should use this frame, when tracing is done by the owning ability. |

### Libraries

**BFL_WidgetInteraction**1 members

extends `BlueprintFunctionLibrary`

Function library returning a pointer index no other widget interaction is using. The counter lives on the game state and is added the first time an index is asked for, so two hands or two players never share one. Call it statically whenever you set up a widget interaction of your own.

| Kind | Name | Signature | Description |
|---|---|---|---|
| fn | `WidgetInteraction_GetFreePointerIndex` | `(Context: Object, __WorldContext: Object, out IndexCounter: int)` | Returns an unused UMG pointer index for this world. Call once per pointer so several hands can drive the same UI. |
