(Pictures) Superior approach/ alternative to Mouse and TargetFilter?

I feel like I’m a bit late to the party on this so I’d just like to know if there are superior methods to the following things.

For a long time I’ve had frustration with mouse.TargetFilter. You know that issue if you have invisible walls or hitboxes that aren’t visible reposition the mouse’s position to something not intended? This is more obvious in third person.

The problem with TargetFilter is it only allows one instance. This is a massive limitation.

I’m thinking I want to avoid all this in favour of something I could even combine for supporting mobile.

How does one accomplish casting a ray from the perspective to a point relative to the screen?


Why am I asking?

I’d like to eventually move this down to some form of mobile support:

Has anyone done this before?
Easiest way to accomplish this?
I genuinely don’t know where to start when it comes to getting 3D space on the 2D perspective.
I want to avoid using traditional mouse.Hit options for this- being able to feed in an x/ y position on the screenspace is more what I’m looking for. I can use mouse.X, mouse.Y for this OR the “fake” crosshair position I want to use on mobile.

I’m specifically looking to how people workaround not using this.

I may have found the solution to this with:

I’ll keep this thread posted with more inqueries or problems I run into. (This could be a resource for people having similar questions/ issues)

Yeah it’s screen point to ray and the question has been answered before.

It’s all UserInputServices, after all it’s superseded mouse.

Simple function to mimic mouse.Hit.Position.

For mobile you just need to get the center of the screen instead of the mouse position and it’s been done before here:

2 Likes