UE4中通C++代码获取屏幕鼠标位置

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/chinahaerbin/article/details/72458107


UE4中通C++代码获取屏幕鼠标位置

UWorld * world = GetWorld();
	if (world)
	{
		APlayerController* pc = world->GetFirstPlayerController();
		if (pc)
		{
			ULocalPlayer* LocalPlayer = pc->GetLocalPlayer();
			if (LocalPlayer && LocalPlayer->ViewportClient)
			{
				FVector2D MousePosition;
				if (LocalPlayer->ViewportClient->GetMousePosition(MousePosition))
				{
					UE_LOG(VRSLog, Warning, TEXT("Cursor.position X :  %f , Y : %f"), MousePosition.X, MousePosition.Y);
				}
			}
		}
	}


展开阅读全文

没有更多推荐了,返回首页