How does the 'depth' property work in ScreenPointToRay?

How does the ‘depth’ property work in ScreenPointToRay?

local function OnRenderStepped()
	local MousePosition2D = UserInputService:GetMouseLocation()
	local MouseRay3D = Camera:ScreenPointToRay(MousePosition2D.X, MousePosition2D.Y, 1)
end

RunService.RenderStepped:Connect(OnRenderStepped)
1 Like

Its how far out the ray goes pretty sure. You can check the documentation for more info on screenpoint to ray

It says:

The depth from the Camera, in studs, from which to offset the origin of the Ray.
Default Value: 0

I assume, like you have already mentioned, that its referring to how far the ray is extended outwards from the starting position?

yes you are right

word count fill here

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.