24 lines
695 B
Lua
24 lines
695 B
Lua
|
|
local PlayerController = {}
|
||
|
|
local KismetSystemLibrary = import("KismetSystemLibrary")
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
function PlayerController:convertCursorToWorldPosition()
|
||
|
|
-- 将当前鼠标的位置转化为世界的位置
|
||
|
|
local FVector = import("Vector")
|
||
|
|
local WorldOrigin, WorldDirection = FVector(), FVector()
|
||
|
|
local _, MouseX, MouseY = self:GetMousePosition(nil, nil)
|
||
|
|
if self:DeprojectScreenPositionToWorld(
|
||
|
|
MouseX, MouseY, WorldOrigin, WorldDirection
|
||
|
|
)then
|
||
|
|
return WorldOrigin.X, WorldOrigin.Y
|
||
|
|
else
|
||
|
|
return nil, nil
|
||
|
|
end
|
||
|
|
end
|
||
|
|
|
||
|
|
function PlayerController:QuitGame()
|
||
|
|
KismetSystemLibrary.QuitGame(self, self, 0, false)
|
||
|
|
end
|
||
|
|
|
||
|
|
return Class(nil, nil, PlayerController)
|