Help please
You can use this function
void CenterViewportCursor(const APlayerController* PlayerController)
{
if( PlayerController )
{
const ULocalPlayer* LocalPlayer = PlayerController->GetLocalPlayer();
if( LocalPlayer && LocalPlayer->ViewportClient )
{
FViewport* Viewport = LocalPlayer->ViewportClient->Viewport;
if( Viewport )
{
FVector2D ViewportSize;
LocalPlayer->ViewportClient->GetViewportSize(ViewportSize);
const int32 X = static_cast<int32>(ViewportSize.X * 0.5f);
const int32 Y = static_cast<int32>(ViewportSize.Y * 0.5f);
Viewport->SetMouse(X, Y);
}
}
}
}
4 Likes