UserInputService < :Click(Vector2), :FindButton(Vector2)

I suggest two new methods for the UserInputService:

:Click(Vector2)
Vector2 argument describes screen space position. Triggers the .MouseButton1Click event on a button which collides with this position.

:FindButton(Vector2)
Vector2 argument describes screen space position. Returns the instance of the button that collides with this position.

The idea behind this is to allow developers create custom interface models, especially for Xbox one where one could make a thumb pad controlled cursor.

Or another idea would be just to make a thumb pad controllable cursor. lol.

I’d say this is more of a random idea than something I personally can’t live without.

2 Likes

How about extend the event/signal object with a method to manually trigger it?
So you could do
button.MouseButton1Click:trigger(args)

Then, you only need to implement “screen space queries” to parallel the ones we can do with regular parts in workspace (similar to raycasting, finding in region, getting touching things):
-ScreenGui:FindGuisOnPoint(pos) --should use same logic as whatever is used to determine what mouse clicks, like topmost first, or however it works
-ScreenGui:FindGuisInRect(rect)
-gui:GetTouchingGuis()

Though, for GUIs (simple boxes) these shouldnt be too costly to implement yourself in Lua. At least the manual triggering would be nice (and would instantly apply to all events of all objects, so it adds flexibility everywhere).

Im not sure if allowing simulating clicks would be easy to implement, as they have to add checks against using it to buy a dev product or something. And those are things you need to be able to do with a cursor, or itll feel broken. So roblox should definitely just provide a built in solution.

That’s a really good observation. Then I guess it could only be a built in feature.
Well, sort of. I don’t think the game would die from a small inconsistency like payment confirming, but hey.

I’ve been wanting to have a generic input invoking API for a while, which would probably look something like:

InputObject, bool UserInputObject:InvokeInput(UserInputType, UserInputState, KeyCode, Position, Delta, Bool) [PluginSecurity]

It would be technically easy to do but I haven’t been able to propose it because I haven’t found enough people who are interested in bulletproofing their interfaces with automated tests.

I don’t know if there’s a use case to invoke input outside of studio. What are you trying to do that you can’t accomplish by just changing your code to listen for a different signal?

If it did work online then roblox would just not process lua inputs on the CoreGui and some other services, and that way there wouldn’t be any issue with purchasing products etc.

I think you’re wanting to have a gamepad cursor that can click guis? If you want that then you can just scan for a button in lua, then set the selected object which will automatically bind the A button to mouse click.

1 Like

I just set up Mad Games for Xbox and tested the gamepad UI navigator.
I gotta hand it to you, that navigator is extremely good. I don’t think any other type of input would make sense at this point.

Yeah, the gamepad navigator is better than witchcraft. I might actually buy an Xbox One just so I can more easily make games for it, it’s so pleasant to work with.

I implemented a gamepad cursor for my game yesterday.
The game doesn’t contain any ImageButtons or TextButtons. I was tired of rewriting guis and wanted more control so I can add stuff like circle buttons, a MouseLeave event that actually works, and Topbar input. I could even make it work with SurfaceGuis or part-guis :open_mouth: Didn’t really think through the gamepad part, but it was very easy to implement a fake mouse:

Edit: Fixed dead gyazo link

1 Like

I got some code somewhere that’s currently linked to the arrows on the numpad.
If I press R and B right after it, it’ll activate some kind of controller thingy.
It’s like a selectionbox, that you can move with those arrows.
It’ll only move to GUI instances of which I say “this is selectable, clicking it does this”.
The original plan was to add controller support, as I build it for that purpose.
(might make a GIF in a few minutes, I’ll see if I still have a GIF recorder thingy)

EDIT: Actually it uses the regular arrows, or notepad with numlock off.
Pressing spacebar “clicks”, pressing enter “clicks” and stops the controller: