How do i make a "mouse" on mobile for first-person

so i want to be able to create a cursor in the middle of the screen for a mobile user, and i want this cursor to be able to:

  • use something similar to Player:GetMouse() where i can see the position of the cursor in 3d space, this is essential for the game i’m making where i want the cursor to be able to, say turn blue when it looks at “workspace.ExamplePart”.

  • ignore certain parts like glass or transparent objects when checking for what it’s currently looking at

i have scoured the devforum but haven’t found anything much like this, and if there is a post that explains how to do this please link it! but other than that any help is appreciated

1 Like

There’s something called Raycasting

Specifically, you can use Camera:ViewportPointToRay(Camera.ViewportSize/2) to get a ray at the middle of your screen, then use workspace:Raycast() with it.

5 Likes

What you can do is calculate the center of the screen using viewportsize and ray cast from there, you can also add parts you want to ignore in your raycast exclusion parameter

3 Likes

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