Hi there!
I’m trying to create a mobile game where you can shoot other players. I’ve created the majority of the systems however I’ve realised a critical issue in the cursor system.
Essentially the cursor isn’t aiming where the UI is. Now before you say “move the UI”, it works 100% on the PC version of the game with the same code and I’m using a scale position to indicate the centre of the screen (see code below).
You can see the issue for yourself here in this video.
-- Environment: Client
function GetCursorPosition()
if PlayerGui:FindFirstChild("Cursor") then
local Position = PlayerGui.Cursor.TextLabel.Position
local Size = PlayerGui.Cursor.TextLabel.Size
local X = workspace.CurrentCamera.ViewportSize.X * Position.X.Scale + (Size.X.Offset / 2)
local Y = workspace.CurrentCamera.ViewportSize.Y * Position.Y.Scale + (Size.Y.Offset / 2)
local _, TargetPosition = getMouseHit(Tank:GetDescendants())
return TargetPosition
end
end
Is there any reason that the position being returned by the function returns something different on mobile devices than on PC?
Many thanks,
-Tom