Introducing, Controller Cursor!
If you’ve ever tried to make your interface’s compatible for players using controllers, you understand that it’s not easy to do. If you’re a player, you understand that it’s hard to navigate UI in many games. This allows players to move a virtual cursor around the screen to select UI, just like players on PC do.
This style of navigation can be found in many AAA titles, most notably Call of Duty and Destiny.
Download
Simply take this module from the catalog and place it in somewhere in the client.
If you prefer syncing the Repository into your game using Rojo, here’s the Repository!
Special thanks to @DanzLua for porting the module to Roblox-ts! This port can be found here
Setup
The module must be required from some LocalScript on the client. To listen to the modules events, you must require the module in a LocalScript.
local ControllerCursor = require(script.ControllerCursor)
--Example event listener
ControllerCursor.GuiObjectSelectionStarted:Connect(function(guiObject)
end)
API Documentation:
function ControllerCursor:ShowCursor()
Shows the cursor, begins polling to update cursor position every frame.
Returns
nil
function ControllerCursor:HideCursor()
Hides the cursor, stops polling.
Returns
nil
Event ControllerCursor.CursorActivated
Fired when the cursor is activated i.e player pressed Select Button or a third-party LocalScript calls the method ControllerCursor:ShowCursor()
Arguments
none
Event ControllerCursor.CursorDeactivated
Fired when the cursor is deactivated i.e player pressed Select Button while Cursor was enabled, or a third-party LocalScript calls the method ControllerCursor:HideCursor()
Arguments
none
Event ControllerCursor.GuiObjectSelectionStarted
Fired when the cursor is selecting a GuiObject.
Arguments
-
SelectedObject
[GuiObject]
The GuiObject the player is currently selecting
Event ControllerCursor.GuiObjectSelectionEnded
Fired when the cursor stops selecting a GuiObject.
Arguments
-
PreviouslySelectedObject
[GuiObject] ornil
The GuiObject the player was selecting before selection stopped
End
Thanks for chekcing this out! If it helps you, please drop a heart! Let me know if you have and issues, questions or recommendations!
Testimonials