Swipe Movement in Unity - Tutorial

Описание к видео Swipe Movement in Unity - Tutorial

In this video, you will learn how to move a player with a swipe gesture, which is very useful for mobile games. This tutorial uses New Input System in Unity. You will notice that this code only adds the basic swipe movement to your player. This is also the next episode of 3D Platformer in Unity.

The swipe detection is considered the best way to move your player with a very simple code, much easier than the 3D platformer code. You will need two scripts: the first one is Player Movement, which is added to a player object, which is a simple cube. The second script is a Swipe Detection, which will be detected on the camera object.

To add a swipe movement, you need to add Input System into your project. You don't need to add anything inside the Input Actions file, you just need to generate a C# class for the input system. Then you need to add Input Action into your script, along with the movement speed. Everything in these scripts is logical, because the Vector3 is a three-dimensional vector of movement that requires the use of two-dimensional movement vector, which is Vector2.

In the swipe detection script, use the basic syntax of every New Input System. If the swipe is performed, move the player to the initial position. If the swipe is canceled, call the function of Swipe Detection, that describes what will the player do in that case.

Support the Creator of Kozmobot on the social networks!

CHECK OUT MY WEBSITE: http://kozmobot.com

INSTAGRAM:   / kozmobot.channel  

TIKTOK:   / kozmobot.channel  

Комментарии

Информация по комментариям в разработке