-
What do you want to achieve? Hello, i currently use Mouse.Hit.Position for the raycast direction in my over the shoulder gun system (it’s a locked OTS so the mouse is always in the middle of the screen)
-
What is the issue? Is there a replacement for it for mobile users, since on mobile if the gun system use Mouse.Hit.Position it shoots in the direction of the shoot button of the ui and not at the center of the screen.
-
What solutions have you tried so far? I tried looking on forums, i found similar posts but it didn’t fix my issue.
2 Likes
If I understand, you want to raycast out from the middle of your screen?
local screenSizeX = workspace.CurrentCamera.ViewportSize.X
local screenSizeY = workspace.CurrentCamera.ViewportSize.Y
local ray = workspace.CurrentCamera:ViewportPointToRay(screenSizeX / 2, screenSizeY / 2)
1 Like
Thanks bro, you helped me a lot!