the main thing this video taught me is that i still have a lot to learn when it comes to coding 😆
@GameDevGeeks18 күн бұрын
lol, if that's the main thing you learned then my video missed it's mark 🙃 don't worry you'll get it
@corn_enthusiast17 күн бұрын
@@GameDevGeeks yeah it was mostly the syntax i struggled with since i'm still fairly new to programming, as well as this "new" input system. But i kind of followed the same logic you used in the video and got it working in the old input system, which i find much more intuitive. And because of this video i also learned what a coroutine is 😄
@jackoberto01 Жыл бұрын
I think It's important for consistency that swipeResistance is calculate based on length of the screen travelled rather than pixels. Resolutions users use can vary greatly and I believe the values you get back are pixel positions
@GameDevGeeks Жыл бұрын
thats an important point
@MichaelBrunner_nur_Michi9 ай бұрын
but don't do screen sizes vary more than pixel density? between phones and tablets, where a swipe with the thumb would still have a similar distance?
@jackoberto019 ай бұрын
@@MichaelBrunner_nur_Michi Screen sizes vary some but pixel density probably is more likely to vary by a huge margin. There's phones that have 720p resolutions and phones which are close to 4k in resolution that's about a 3 times increase in both width and height or 9 times increase in pixel density. While screen size may also double or triple that's unlikely if you're designing mainly for phones. An even more comprehensive solution may take the screen size into account if you want a real life "distance" as the parameter of when to trigger the detection.
@lyten428710 ай бұрын
Thanks for such a great tutorial and for the link to the code.
@johnmichaeldeleon32983 ай бұрын
Hello, great video. Is it possible to return the Tap event ? For example to make the cube jump. Thank you
@SreeHarryyАй бұрын
thanks man!
@paulstaring61888 ай бұрын
Question, I keep getting the error "NullReferenceException: Object reference not set to an instance of an object MovementManager.Awake () (at Assets/Scripts/CubeMovement.cs:13)" . Any clue how to fix that?
@GameDevGeeks8 ай бұрын
Hi. you can add "[DefaultExecutionOrder(-100)]" on the line above "public class SwipeDetection : MonoBehaviour" in the swipe detection script. and make sure the InputAction move has a value in the cube script. if you follow the video carefully it 'should' be working.
@jhgfghjfuzrtfchchghgf11 ай бұрын
I dont understand a thing of whats going on here. what are the things you reference? what names did you use where? how do your inputactions look like?
@GameDevGeeks11 ай бұрын
Hey! in 6:30 I made a static variable for easier reference to the swipe detection object. you can search for Singlton Patten to learn more about this. as for the names I'm not sure which names you are confused about. and the input actions are inside the script instead of an input action map and you can see their bindings at 7:30
@ErenBR562 Жыл бұрын
How can I pinch gesture mobile to zoom in and zoom out on the camera? I created a zoom in/out function using the mouse scroll wheel, however, I would like to know how I can pinch using the new system input, thanks!
@GameDevGeeks Жыл бұрын
kzbin.info/www/bejne/oHy5hX6Beddqd80 sorry for late response I had connectivity issues
@ErenBR562 Жыл бұрын
@@GameDevGeeks WoooW Thanks! Do you have discord? I wanted to show you how my script is, thanks!
@ErenBR562 Жыл бұрын
@@GameDevGeeksThank you my friend! I will be deleting the message because it contains your private contact, I already added you, thank you very much!
@i_am_reshad Жыл бұрын
it helped me a lot man, just curious how to block diagonal swipes
@GameDevGeeks Жыл бұрын
one simple way would be to put else to only detect in one axis or the other like this: private void DetectSwipe () { Vector2 delta = currentPos - initialPos; Vector2 direction = Vector2.zero; if(Mathf.Abs(delta.x) > swipeResistance) { direction.x = Mathf.Clamp(delta.x, -1, 1); } else if(Mathf.Abs(delta.y) > swipeResistance) { direction.y = Mathf.Clamp(delta.y, -1, 1); } if(direction != Vector2.zero & swipePerformed != null) swipePerformed(direction); }
@GameDevGeeks Жыл бұрын
or you can do pretty much the same thing but check which direction is swiped longer: private void DetectSwipe () { Vector2 delta = currentPos - initialPos; Vector2 direction = Vector2.zero; if(delta.magnitude > swipeResistance){ if(Mathf.Abs(delta.x) > Mathf.Abs(delta.y)) { direction.x = Mathf.Clamp(delta.x, -1, 1); } else if(Mathf.Abs(delta.y) > (Mathf.Abs(delta.x)) { direction.y = Mathf.Clamp(delta.y, -1, 1); } } if(direction != Vector2.zero & swipePerformed != null) swipePerformed(direction); }
@GameDevGeeks Жыл бұрын
or you can do pretty much the same thing but check which direction is swiped longer: private void DetectSwipe () { Vector2 delta = currentPos - initialPos; Vector2 direction = Vector2.zero; if(delta.magnitude > swipeResistance){ if(Mathf.Abs(delta.x) > Mathf.Abs(delta.y)) { direction.x = Mathf.Clamp(delta.x, -1, 1); } else if(Mathf.Abs(delta.y) > (Mathf.Abs(delta.x)) { direction.y = Mathf.Clamp(delta.y, -1, 1); } } if(direction != Vector2.zero & swipePerformed != null) swipePerformed(direction); }