UserInputService equivalent of Mouse.Hit.p?

Hi –
I’ve started migrating all of my work to utilise the newest in ROBLOX APIs.

I’m currently working on changing Mouse.Hit.p to UserInputService however I cannot find a desired result.

I can successfully convert the UIs 2D to 3D using :ScreenPointToRay. However, because of the changes made to Raycast ( Now using Raycast Params etc ) – I am only able to receive a result of a position IF the Raycast makes contact where as with Mouse.Hit.p I get the Vector3 regardless.

Does anyone know any work arounds to this? As ideally I wish to receive the World Space Vector3 regardless of whether or not a RaycastResult is found.

Thank you!

If the raycast did not hit anything, you can add the origin and the direction of the raycast to get the end of the raycast.

1 Like