[SOLVED] Touch screen joystick


In my project, I’m working on mobile management. At the moment, the control of the camera with the mouse and the movement with the WASD keys are implemented. I also implemented camera control using touch events in the right area of ​​the screen. Now I want to make a player move using touch events in the left area of the screen. For example, there is a joystick, when touched at the top on which the player will go forward. If you touch up and left, then the player must go forward and left. Can you please tell me how to implement this control algorithm? Thanks.

Link to the project: https://playcanvas.com/editor/scene/726892
Example joystick: Joystick

Hi. This repo un Github will be useful

If it’s a standard d-pad, you can make 4 separate buttons.

If you are thinking more of an analogue stick, then I need to pull out one of my projects.

This is a version of a touch screen joystick that was done pre UI system that I haven’t had a chance to convert over.

It should give a rough idea on how to approach it: https://playcanvas.com/project/607704/overview/old-on-screen-joystick

I get error 404. Apparently this is a private project? :slightly_smiling_face:

Thank you, I will look at this project. :slightly_smiling_face:

Derp. Apparently it is. (I forgot the project I forked from is private).