RealDocs

UKismetInputLibrary::PointerEvent_GetScreenSpacePosition

function Engine Blueprint Since unknown
#include "Kismet/KismetInputLibrary.h"
Access: public Specifiers: staticBlueprintPure

Description

Returns the current position of the cursor or touch point in screen space, in pixels.

Caveats & Gotchas

  • Screen space, not viewport or widget-local space — use the widget's geometry to convert if you need local coordinates.
  • On multi-monitor setups this is relative to the full desktop, so values can be negative or exceed a single monitor's resolution.

Signature

static FVector2D PointerEvent_GetScreenSpacePosition(const FPointerEvent& Input);

Parameters

Name Type Description Default
Input const FPointerEvent& The pointer event to read the cursor position from.

Return Type

FVector2D

Example

Track cursor screen position on mouse move C++
FReply UMyWidget::NativeOnMouseMove(const FGeometry& InGeometry, const FPointerEvent& InMouseEvent)
{
    const FVector2D ScreenPos = UKismetInputLibrary::PointerEvent_GetScreenSpacePosition(InMouseEvent);
    UpdateCrosshairScreenPosition(ScreenPos);
    return FReply::Handled();
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.