Hello so my issue is really simple. How do I raycast the middle of the camera?
I have a game that is in first personn and I want prompts to show up based on which prompt is closer to the very center of the camera.
I will put a dot in the middle of the users screen so that they can tell where the center is.
I would do this with the mouse (which I actually have right now) however mobile players don’t have a mouse so I cant.
here is my current code:
local Raycastparams = RaycastParams.new()
Raycastparams.FilterType = Enum.RaycastFilterType.Blacklist
Raycastparams.FilterDescendantsInstances = {game.Players.LocalPlayer.Character}
Raycastparams.IgnoreWater = true
local camera = workspace.CurrentCamera
local viewportCenter = Vector2.new(camera.ViewportSize.X/2, camera.ViewportSize.Y/2)
local viewportRay = camera:ViewportPointToRay(viewportCenter.X, viewportCenter.Y)
local raycastResult = workspace:Raycast(viewportRay.Origin, viewportRay.Direction, Raycastparams)