How do I get Mouse X and Mouse Y relative towards the players camera

I am trying to get Mouse X and Mouse Y relative towards the players camera, so when my mouse is as far as it can go left it should be 0. Here is what I have.

3 Likes

It looks like there’s no way to accurately get a player’s mouse position relative to the top left of their viewport. You can make a suggestion to add a script like that to Modd.io if you want.
However, I did some tests and found that the number of in-game units of distance that a player’s viewport is in height is approximately equal to their zoom level and in width is approximately 2.11 times their zoom level. I don’t know if this may be different for screens with other aspect ratios or pixel sizes, though (my viewport’s dimensions were 1422x668).

Here is a script that worked for me:

2 Likes