Keeping mouse location on center on mobile?

Hello.
I am trying to implement mobile support to my football game right now and I am having some issues with mouse location. On PC, the ball is shot to the mouse position. When I added the buttons to mobile, I realized that the mouse location changes to whichever side of screen the player touches, even if it is for using the walk joystick or the buttons. So to get my game to work:
1-) I need to somehow make it so that it doesn’t change the mouse location when player uses one of the GUIs, including the built-in ones like walking and jumping.
2-) Or alternatively, could it work if there is a way to lock the mouse in middle of the screen in a way that it won’t change when touched somewhere else?

I don’t know how to do either of them though. Any ideas?

2 Likes

Why don’t you, instead of searching for mouse position on mobile, simply get the center location of the screen and use those vectors instead?

2 Likes

Oh lol yes that makes sense. I will try using lookvector of the character instead

1 Like

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