Unity Touch Joystick Player Movement - Touch FPS Controller (Part 1)

preview_player
Показать описание

This Unity C# tutorial (part 1 of 2) will show you how to create a FPS controller for mobile apps similar to Dead Trigger or ShadowGun. In Part 1 we create a touchscreen joystick to move our player around. In the next and last tutorial of this series (Part 2) we will extend the functionality of this joystick to create another joystick that will control player rotation. So we can have 2 joysticks on screen instead of 1 joystick and a swipe touch pad.

Time Breakdown:
0:30 - Overview and preparation of the scene
1:50 - Setting up the variables for our joystick script
2:20 - Transform positions vs pixel inset values
4:50 - Cache some variables in the Start function
6:35 - Adding touch2Watch to our TouchLogic script
7:25 - Using OnTouchBegan to cache our touch index
8:50 - Moving the joystick with OnTouchMovedAnywhere
10:50 - Converting touch position to percentage of screen size
12:10 - Calculating the new position of the joystick using our touch2Watch
12:30 - Demonstration of the joystick moving
13:00 - Limiting the how far our joystick can move across the screen
14:15 - Demonstation of the new limits on our joystick
14:50 - Making the joystick snap back to its initial position when we let go of it
15:40 - Demonstration of the joystick snapping back
16:18 - Calculating the joyDelta so we can use it to move the player
17:50 - Using the joyDelta to move the player
20:25 - Demonstration of the joystick moving the player
21:00 - Outro, next video will will focus on player rotation with a joystick

Thanks for watching :D
Рекомендации по теме