In my 2D project on Roblox, I’ve been using Mouse.Hit for things like aiming weapons and, specifically right now, making the character look at the mouse’s position.
However, since the mouse will typically be pointing at the skybox, Mouse.Hit.p gives values like -2139.658935546875, 5608.1044921875, -7989.4189453125, when I would want something like (100, 30, 0). Obviously, I can multiply this Vector3 by (1, 1, 0) to get rid of the Z-value, but it’s still the wrong X and Y values, which is a problem.
I’ve looked on the forums and tried Camera:WorldToScreenPoint with UserInputService:GetMouseLocation among other things, but nothing seems to work.
So, how do I get an accurate position of the mouse in this case?
An image of my game so you can get the idea of what I’m doing:
(while the image shows that the character is looking at the mouse in this picture, at most angles it doesn’t work, and I’ve confirmed that the problem is with mouse.Hit)