How to Implement a Touch Movement Joystick Using the New Input System #shorts




Published: 25 Aug 2022

This week you can learn how to add a Touch Movement Joystick to control your player using the New Input System. We'll specifically look at how to do that with a NavMeshAgent, but the same concept can be applied to Rigidbody movement or a CharacterController. In this tutorial you'll learn the full end to end process of Joystick Creation, Canvas Setup, & Code, along with some of the "gotchas" I learned when implementing my own mobile game so you don't have to run into the same struggles!


The Enhanced Touch API raises events onFingerDown, onFingerMove, and onFingerUp events to us when the user touches, moves, or lets go of the screen. It keeps track of which finger is doing what, so we can track each finger separately.


As always, the full project code is available on GitHub: https://github.com/llamacademy/mobile-touch-inputs for you to play around with.


📚 Resources

⚫ Enhanced Touch: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.2/api/UnityEngine.InputSystem.EnhancedTouch.Touch.html

⚫ Unity Manual for Touch Input: https://docs.unity3d.com/Packages/com.unity.inputsystem@1.2/manual/Touch.html


📱 Let's stay connected

YouTube: https://youtube.com/c/LlamAcademy

Patreon: https://www.patreon.com/llamacademy

Facebook: https://facebook.com/LlamAcademyOfficial

Twitter: https://twitter.com/TheLlamAcademy

TikTok: https://tiktok.com/@LlamAcademy

Instagram: https://instagram.com/LlamAcademy


----


Believe in LlamAcademy's mission and have received value from the videos? Consider becoming a Patreon supporter: https://www.patreon.com/llamacademy


----

Most tutorials come from knowledge gained making https://survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.

I also have some Unity Assets (affiliate link): https://assetstore.unity.com/publishers/22409?_aid=1101l9QvC


Connect on Social Media

Some links may be affiliate links, which at no additional cost to you, gives LlamAcademy a small portion of the purchase.