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.
💸 Ongoing sales 💸
⚫ See all active asset sales on the Asset Store: assetstore.unity.com/?on_sale...
⚫ Save 25% off your first Asset Store Order: prf.hn/click/camref:1101l9QvC...
⚫ Save up to 50% on NEW Assets: assetstore.unity.com/?new_sal...
👨💻As always, the full project code is available on GitHub: github.com/llamacademy/mobile... for you to play around with.
📚 Resources
⚫ Enhanced Touch: docs.unity3d.com/Packages/com...
⚫ Unity Manual for Touch Input: docs.unity3d.com/Packages/com...
❤ Believe in LlamAcademy's mission and have received value from the videos? Become a Patreon Supporter or RU-vid Member:
⚫ Patreon: / llamacademy
⚫ RU-vid Member: / @llamacademy or click the Join button on any video
📱 Let's stay connected
RU-vid: / llamacademy
Patreon: / llamacademy
Facebook: / llamacademyofficial
Twitter: / thellamacademy
TikTok: / llamacademy
Instagram: / llamacademy
----
Most tutorials come from knowledge gained making survival.llama.software Llama Survival - a top-down zombie survival shooter for Android and iOS.
I also have some Unity Assets (affiliate link): assetstore.unity.com/publishe...
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
#unitytutorial #tutorialtuesday #gamedev #tutorial #unity #llamacademy #gamedevelopment
Chapters:
00:00 Adding Touch Input Support - High Level Overview
02:32 Creating your Joystick & Canvas Setup
04:18 Quick Scene Overview & Enable Virtual Touch
05:12 References & FloatingJoystick.cs Review - PlayerTouchMovement.cs
06:44 Enable Touch Support & Add/Remove Event Listeners - PlayerTouchMovement.cs
07:30 HandleFingerDown - PlayerTouchMovement.cs
09:46 HandleFIngerMove - PlayerTouchMovement.cs
11:10 HandleLoseFinger - PlayerTouchMovement.cs
11:44 Actually Moving the Player - PlayerTouchMovement.cs
13:32 Demo & Thoughts on Player Rotation
14 июл 2024