How to make Mobile always click center?

Hi,

I am making a mobile game and I want it so that when the player clicks anywhere, it is clicking in the middle (custom cursor ui in the middle). How do I achieve this?

3 Likes

I’m not sure what you mean by

Do you mean moving the custom cursor UI in the middle of a frame?

1 Like

You can’t manipulate the mouse to always click on the center directly, you can if you’re on PC using MouseBehavior but i don’t think it’s possible on Mobile

1 Like

I mean manipulating the mobile touch so that if you touch anywhere, it clicks in the middle, where my crosshair ui is

Well maybe I don’t have to manipulate the mouse on mobile then. Maybe I can do that if the player touches the screen, it sends a ray in the middle or something like that. I’m not sure but this should be possible somehow.

Try coding it so that whenever the player just touches the screen, it’ll do something in the middle.

giving it the effect of the player clicking in the middle.

1 Like

Hey! Are you trying to do a pistol for mobile?

No, I’m making a interaction system that involves clickdetectors and the problem is I don’t want mobile players to have to move their finger to where they want to click. I want them to instead be able to click anywhere and the click would be in the middle.

I want it for click detectors, but my assumption is that I need to connect the touch event and send a ray in the middle that detects if theres anything in the middle of the crosshair and if there is, check if its a click detector then activate the click detector manually. I’m not sure where to start when it comes to raycasting though but I’ll try to figure it out

its not possible to simulate a click, but the only way i know its possible is by raycasting from Camera.CFrame to Camera.CFrame.LookVector, then you check if the part that intersected the ray is the part that haves the click detector. Only inconvinient its that only works in first person

1 Like

Good thing my game is First Person Only. Thanks! I’ll try this.

1 Like

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