Hi, first post, an I’m sure the first of many questions!
I’m trying to set up a movement system where the player can touch anywhere on the screen and enable, then use, a virtual thumbstick at the point of contact for top down player movement.
I can’t seem to find much info on how to do this with the new enhanced input actions, so would appreciate some advice or pointing in the right direction.
To set up touch joystick movement using enhanced input actions, you can follow these general steps:
Create a new input action in your input settings. Open the Input Manager or input configuration file for your game engine/framework and define a new input action for the touch movement, such as “TouchMovement.”
Set up the touch input detection. In your game code, detect when the player touches the screen. This can be done using the touch input system provided by your game engine or framework. Capture the touch position when it occurs.
Calculate the direction and magnitude of the touch movement. When the touch input is detected, calculate the direction and magnitude of the movement based on the touch position relative to the initial touch point. You can use vector math to achieve this.
Map the touch movement to the virtual thumbstick. Convert the direction and magnitude of the touch movement into values suitable for controlling the virtual thumbstick. This may involve mapping the touch movement to specific input axes or variables that control the thumbstick behavior.
Update the player movement based on the virtual thumbstick input. Continuously read the input values from the virtual thumbstick and use them to control the player’s movement in the desired direction.
It’s important to note that the exact implementation may vary depending on the game engine or framework you’re using, as well as the specific input system you have in place. Consult the documentation or resources specific to your development environment for more detailed instructions or code examples.
While enhanced input actions are designed to provide a unified input system, the specific implementation details may differ depending on the platform and development environment. Consult the documentation and resources for your specific platform and framework to understand how to integrate enhanced input actions with touch-based joystick movement.