Posted October 08, 2020 by Giavapps
#giavapps #controller #stick
THE CONTROLLER STICK
The Controller Stick is a UI Component that can be very useful for providing a Controller Stick on Mobile Platforms without losing compatibility with Desktop Platforms.
When creating your own custom stick, you must set the ControllerStickObject as a parent of your object.
MAPPING INPUTS
ControllerStickObject provides the Up, Down, Left, Right local structs with their Add() method for mapping multiple Button Inputs to the various directions.
In the example above, pressing or releasing those various Keyboard and GamePad inputs will affect the Stick Properties of the Controller Stick.
ControllerStickObject also provides the SetGamePadAxes() method for controlling the Controller Stick from a specific GamePad.
PLEASE NOTE
Don't forget to set the GamePad Dead Zone if you plan to use the GamePad Axes.
STICK PROPERTIES
ControllerStickObject provides the X, Y, Magnitude and Direction local variables.
Assuming you have a reference to an object that inherits from ControllerStickObject you can easily access to those variables.
REMARKS
When you set a ControllerStickObject as Not Visible, Mouse Clicks and Touch Inputs are ignored while the inputs coming from Button Inputs you Add() and the GamePad Axes you set are still detected.