Unity Mobile - Swipe Controls - Unity 3D [Tutorial]

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

ความคิดเห็น • 251

  • @MarkOffenberg
    @MarkOffenberg 6 ปีที่แล้ว +6

    I usually never write comments on tutorials, but i just have to say something
    What a fantasic tutorial man, you explain everything so well, thanks!

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว

      Hey, me and my friend are really struggling to get this figured out. Is there anyway you could send me a copy of your completed script, so we can check where we went wrong? Thanks!

  • @sauerkrautyo242
    @sauerkrautyo242 6 ปีที่แล้ว +16

    private void Start()
    {
    desiredPosition = player.position;
    }
    if your cube moves around to a certain position @ the start of the scene

    • @EnglishBloke1
      @EnglishBloke1 5 ปีที่แล้ว

      Where do I put this?

    • @maazmaaz97
      @maazmaaz97 5 ปีที่แล้ว +1

      @@EnglishBloke1 In Swipetest script

    • @Sir_kryszo
      @Sir_kryszo 4 ปีที่แล้ว

      Thanks!!!!!!!!!!....I love you

    • @momozaki4453
      @momozaki4453 4 ปีที่แล้ว

      MAN, YOU ARE A SAVIOR !!😊👍👍👍

    • @timothypsina
      @timothypsina 4 ปีที่แล้ว

      2 problems solved, thank you so much!

  • @Hacsev
    @Hacsev 7 ปีที่แล้ว +14

    This was the tutorial I was waiting for! Been trying to code a reliable swipe script this past few months and this is the best one I've found. Thank you so much and keep up the great work!

    • @n3ken
      @n3ken  7 ปีที่แล้ว +3

      fast simple reliable!

    • @batus6871
      @batus6871 7 ปีที่แล้ว

      N3K EN this can help me if i do a swipe and then the character jump the problem comes in the position move cause is to slow :(

    • @austinbryan6759
      @austinbryan6759 6 ปีที่แล้ว

      A few months is a sure long time

    • @silentgamer2555
      @silentgamer2555 4 ปีที่แล้ว

      @@n3ken its not working there is no error everything is fine but not working

  • @razvantudor7368
    @razvantudor7368 7 ปีที่แล้ว +1

    Just what I needed for a little personal mobile project I'm making. After a few alterations it worked like a charm!
    You are the best!!
    Cheers and keep them coming!

    • @n3ken
      @n3ken  7 ปีที่แล้ว

      Glad it helped!

  • @rafcon9141
    @rafcon9141 3 ปีที่แล้ว +1

    What should I do if I only want to be able to swipe on a certain area? Like left half of the screen?

  • @guillemrossalvador
    @guillemrossalvador 7 ปีที่แล้ว +4

    Literally exactly what I needed, thank you so much N3KEN!

    • @n3ken
      @n3ken  7 ปีที่แล้ว

      Nice! Glad it helps :D

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว

      @@n3ken is there any way you could send the completed script to me? My friend and I are struggling to figure out where we went wrong. Thanks for the vid tho!

  • @hunyomata9749
    @hunyomata9749 6 ปีที่แล้ว +2

    I use 2D unity then it stays on the middle at 0, 0 ,0 and keeps moving to the right I swiped but it just debug.log and not swiping up nor down nor left nor right

  • @Caden_Burleson
    @Caden_Burleson 6 ปีที่แล้ว +3

    Do you have a website where I can download the code files from this video?

  • @kitthekat6844
    @kitthekat6844 5 ปีที่แล้ว +22

    Did you just forgot to edit out your intro outakes? -.-
    The rest of the video is good tho, quite useful and well explained! Thanks

    • @Sparrow420
      @Sparrow420 4 ปีที่แล้ว +1

      I just got off work and lit up, thanks for the sanity check, lol

    • @HexerMain
      @HexerMain 4 ปีที่แล้ว

      Haha yeah just noticed. Didn't even realize the first time I watched it.

  • @Othello379
    @Othello379 4 ปีที่แล้ว +1

    this is so nice explained and everything! Big thank you! :)

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว

      Hey, me and my friend are really struggling to get this figured out. Is there anyway you could send me a copy of your completed script, so we can check where we went wrong? Thanks!

  • @TrashAcct-j7o
    @TrashAcct-j7o 11 หลายเดือนก่อน

    What am I missing error cs1001 identifier expected, (if(Input.touches.[0].phase == TouchPhase.Began))

  • @NizarudinFahmi2201
    @NizarudinFahmi2201 7 ปีที่แล้ว +4

    THIS IS WHAT I NEED! THANK YOU SO MUCH!!

    • @n3ken
      @n3ken  7 ปีที่แล้ว

      *celebrate*

  • @clarisrichter7966
    @clarisrichter7966 4 ปีที่แล้ว +5

    Thank you for the tutorial. Unfortunately tap registers everytime the mouse is released, and that's not very useful. I only want taps to register if I didn't swipe and move.
    To solve this, I created another boolean called "moved", and I set it to false on the mouse down or input touch down function. Where we check the magnitude to be greater than 125 I set moved to true. Then, at the top of the reset function I check if moved is false and then set tap to true. If you want a form of sensitivity where a half assed swipe doesn't count as a tap you can test the maginitude of deltaSwipe there too and make sure it's below a certain value, meaning that the finger was still for most of the tap.

    • @HexerMain
      @HexerMain 4 ปีที่แล้ว

      Thanks a lot!

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว

      Hey, me and my friend are really struggling to get this figured out. Is there anyway you could send me a copy of your completed script, so we can check where we went wrong? Thanks!

    • @HexerMain
      @HexerMain 4 ปีที่แล้ว

      Zach VanDyke I can tomorrow, if you guys want.

    • @clarisrichter7966
      @clarisrichter7966 4 ปีที่แล้ว +1

      @@zachvandyke9528 Looks like Hexer's got you sorted. If you still need help just drop me an email at claris.richter@gmail.com and I'll send over the completed code

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว

      @@HexerMain thank you so much, it would mean a ton!

  • @Reonis
    @Reonis 7 ปีที่แล้ว

    Good day, there's a little bug, while u trying to make a swipe, it will always execute a tap firstly, which can bring some difficultues in games. To avoid this as one of solutions u can bring tap = true; from ButtonDown method to ButtonUp

  • @timo4024
    @timo4024 6 ปีที่แล้ว +1

    Great video, but i got problems. If I add the script to my object everything wiggles around if I hit play. My normal movement script that effects that the object runs automatically towards the z axis also doesn't work. Perhaps a reason for this is, that i made a jump script which includes that if the swipeControl is up the object jumps. I really don't know what to do now.
    I'm looking forward an answer

  • @papakipari-27
    @papakipari-27 6 ปีที่แล้ว +4

    thanks for this great tutorial. i have some prob when i hit play object automatic move on origin 0 and im try only left right when i click left its constantly move and then stopped but when i clicked right its working fine when i release touch its stopped but its not working in left click what can i do plz help

  • @padyeah
    @padyeah 7 ปีที่แล้ว

    A great thanks! Succeeded in decvelopping a cool y swipe in my mobile game with few knowledges in C#. You'll be in the credits mate ;)

  • @unamusedrowlett6303
    @unamusedrowlett6303 3 ปีที่แล้ว

    Apologies for the question giving how old the video is. How would you go about making it so the player can only swipe a certain amount of time and How would you change the speed of the object being swiped in a direction?

  • @CURSEDIMAGES
    @CURSEDIMAGES 7 ปีที่แล้ว +4

    how can i adjust the force on the swipe, so i had a ball moving and want it to move faster left or right

    • @kibou5832
      @kibou5832 3 ปีที่แล้ว +1

      if you use a deadzone i would check the deltatime has passed since the touch started and if you dont use a deadzone i would check the magitude of the swipeDelta but implement a maximum.

  • @MrHamidG
    @MrHamidG 6 ปีที่แล้ว +1

    Hi . I worte the code, but somehow no mater which direction I drag, it drag also to the right
    Here is my code :
    can you please tell me where is the bug ?
    tnx in advance
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    public class Swipe : MonoBehaviour
    {
    public bool tap, swipeLeft, swipeRight, swipeUp, swipeDown;
    private bool isDraging = false;
    private Vector2 startTouch, swipeDelta;
    // Update is called once per frame
    private void Update ()
    {
    tap = swipeLeft = swipeRight = swipeUp = swipeDown = false;
    #region Standalone Inputs
    if(Input.GetMouseButtonDown(0)) // 0 is the Left click
    {
    tap = true;
    isDraging = true;
    startTouch = Input.mousePosition;
    }
    else if(Input.GetMouseButtonUp(0))
    {
    isDraging = false;
    Reset();
    }
    #endregion
    #region Mobile Inputs
    if(Input.touches.Length > Mathf.Epsilon)
    {
    if(Input.touches[0].phase == TouchPhase.Began)
    {
    tap = true;
    isDraging = true;
    startTouch = Input.touches[0].position;
    }
    else if(Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
    {
    isDraging = false;
    Reset();
    }
    }
    #endregion
    // Calculate the distance
    swipeDelta = Vector2.zero;
    if(isDraging)
    {
    if(Input.touches.Length > Mathf.Epsilon)
    {
    swipeDelta = Input.touches[0].position - startTouch;
    }
    else if (Input.GetMouseButton(0))
    {
    swipeDelta = (Vector2)Input.mousePosition - startTouch;
    }
    }
    // Did we cross the deadzone ?
    if(swipeDelta.magnitude >125)
    {
    // Which Direction ?
    float x = swipeDelta.x;
    float y = swipeDelta.y;
    if(Mathf.Abs(x) > Mathf.Abs(y))
    {
    //Left or Right
    if (x < Mathf.Epsilon)
    {
    //swipeLeft = true;
    print("Left");
    }
    else
    {
    //swipeRight = true;
    print("Right");
    }
    }
    else
    {
    // up or down
    if (y < Mathf.Epsilon)
    {
    // swipeDown = true;
    print("down");
    }
    else
    {
    //swipeUp = true;
    print("up");
    }
    }
    Reset();
    }
    }
    private void Reset()
    {
    startTouch= Vector2.zero;
    swipeDelta = Vector2.zero;
    }
    }

  • @IM-jz3px
    @IM-jz3px 7 ปีที่แล้ว +1

    Fantastic video. How can you make the object move faster and over a larger area with every swipe?

  • @khandelwalmitesh3
    @khandelwalmitesh3 7 ปีที่แล้ว

    Exactly what i was looking for.......Thank u soo much

  • @GameOver7853
    @GameOver7853 7 ปีที่แล้ว

    N3K is love, N3K is life

  • @aminovichpro
    @aminovichpro 7 ปีที่แล้ว +3

    hey thats a life saver thank you N3K and i have 2 questions the script work fine how to add a force because the player moves slow seconde when i start the game the player automaticly being back to postion(0,0,0) how to enable that so the player stay in his position ?

  • @UltraDraft
    @UltraDraft 7 ปีที่แล้ว

    Honestly ,you're amazing .

  • @samettunay4058
    @samettunay4058 4 ปีที่แล้ว

    I really needed this thanks

  • @zainulabdeen1469
    @zainulabdeen1469 6 ปีที่แล้ว

    great tutorial helped me a lot .... thanks buddy

  • @OscarTorresWork
    @OscarTorresWork 7 ปีที่แล้ว +2

    Thank you for these tutorials so helpful im learning c# im greatfull people like you do this sort of thing, looking forward to the subway surfer game 😊👍👍

    • @n3ken
      @n3ken  7 ปีที่แล้ว +1

      Thanks for the kind comment oscar!

  • @chineduachimalo391
    @chineduachimalo391 6 ปีที่แล้ว

    how do i do tap and double tap with this and, there is a delay when i swipe up multiple times then swipe down

  • @hakemhamdoud689
    @hakemhamdoud689 2 ปีที่แล้ว

    Thanks You really Saved My ❤❤

  • @TdB_Snip3r-nf6jh
    @TdB_Snip3r-nf6jh 5 ปีที่แล้ว

    Excuse me, i write your code but only when i do swipeDown the swipeTest detect all types of swipe a loop. I don't know where i wrong :(

  • @llits4898
    @llits4898 5 ปีที่แล้ว +1

    Is there anyway to use this in a top down game? When I implemented it in my 2D top down game, I can go left or right. But swiping up or down on the screen moves the game object forward or backwards on the Z axis. Is there something I'm missing?

    • @Ubagine1205
      @Ubagine1205 3 ปีที่แล้ว

      Did you fix it ?

    • @Ubagine1205
      @Ubagine1205 3 ปีที่แล้ว

      ohh nvm fixed it:]

  • @irvintiu
    @irvintiu 7 ปีที่แล้ว

    hi there! i have a question. i made a game, and i use the getkeycode to makethe character attack. so im planning to put this game to android devices. and i have the code of swiping setup. also i dont like to lose all the getkeycodes, so that i can test it on laptop. i was wondering if there is a way to make the swipe = getkeycode:a,s" or something like that.

  • @glodas_
    @glodas_ 6 ปีที่แล้ว

    Very useful, thanks a lot man!

  • @Adomas_B
    @Adomas_B 4 ปีที่แล้ว

    Wait, why is mouse position a Vector3? Like how your mouse can go into the 3rd dimension

  • @TrickerBaby
    @TrickerBaby 7 ปีที่แล้ว +6

    hey men what about that swipe test script is there a link to that ? or when did you make it??

    • @MarcosKruby07
      @MarcosKruby07 7 ปีที่แล้ว +1

      He just jump that part, by his balls jajajaja, i think that just copy paste that.

    • @austinbryan6759
      @austinbryan6759 6 ปีที่แล้ว +7

      Never copy and paste code, it's best to type them in yourself. It forces you to understand what's going on exactly and also helps build that muscle memory too. Everyone in my college copy and pasted code. They never had any idea what was going on.

  • @Ascaron50
    @Ascaron50 6 ปีที่แล้ว

    How can you make a difference between tap and swipe if I want just one action to take place ?

  • @facepalmcylox6390
    @facepalmcylox6390 7 ปีที่แล้ว

    Thank you so much.. This is what i needed. really helpful tutorial. You rock!

  • @rojenonat3951
    @rojenonat3951 4 ปีที่แล้ว

    Awsome tutorial!

  • @SadBathtub
    @SadBathtub 6 ปีที่แล้ว

    i am new to coding (i am mainly a level designer) and this was a huge help but even though i have no code errors unity gives me this "StackOverflowException: The requested operation caused a stack overflow."

    • @keronsepp2530
      @keronsepp2530 5 ปีที่แล้ว

      Probably because your public bool SwipeLeft { get { return SwipeLeft; } } instead of return swipeLeft ( with lower case)
      Obv too late, but may help someone else

  • @RemessOfficial
    @RemessOfficial 6 ปีที่แล้ว

    works good for what I need. Thanks a lot!

  • @Mohammadkashifkhan2093
    @Mohammadkashifkhan2093 6 ปีที่แล้ว

    Hi there, i am new to unity, what i am trying to do is swipe between cards horizontally for that what i did earlier was used lerp to switch back and forth, everything works fine but the sensitivity isnt that good for instance if swipe even a little bit towards left the swipe takes place, i dont know how to implement this script in that script , could you help me pls

  • @topsl69
    @topsl69 6 ปีที่แล้ว

    I can't drag the Swipe.cs Script into the Swipe slot of my player object. Please help!

  • @Present300
    @Present300 7 ปีที่แล้ว +2

    Thank you for tutorial! Tell me plz, what if I want to do smth on tap, and action on swipe, then in this script OnTap action going to act every time when I tap on screen, and when I swipe. How to divide this 2 actions? Thank in advance!

    • @HexerMain
      @HexerMain 4 ปีที่แล้ว

      Claris Richter answered that!
      To solve this, I created another boolean called "moved", and I set it to false on the mouse down or input touch down function. Where we check the magnitude to be greater than 125 I set moved to true. Then, at the top of the reset function I check if moved is false and then set tap to true. If you want a form of sensitivity where a half assed swipe doesn't count as a tap you can test the maginitude of deltaSwipe there too and make sure it's below a certain value, meaning that the finger was still for most of the tap.

  • @amrsaleh9954
    @amrsaleh9954 6 ปีที่แล้ว

    Great Video Very Helpful

  • @nikabekauri3171
    @nikabekauri3171 4 ปีที่แล้ว

    When I finish the project I`m working on, I will be will be exporting it to Webgl, any ideas if this will still work in the browser like chrome?

  • @MC-mi5qw
    @MC-mi5qw 4 ปีที่แล้ว

    Hey there, I followed this tutorial but right at the end I get this message: "error CS0246: The type or namespace name 'Swipe' could not be found (are you missing a using directive or an assembly reference?)". How can I fix this? Thanks

    • @headshot4256
      @headshot4256 4 ปีที่แล้ว

      th-cam.com/video/rDK_3qXHAFg/w-d-xo.html

  • @jawwadijaz6174
    @jawwadijaz6174 7 ปีที่แล้ว +2

    Thanks alot, this works 100% for me

    • @n3ken
      @n3ken  7 ปีที่แล้ว +1

      Glad it did ;3

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว

      Hey, me and my friend are really struggling to get this figured out. Is there anyway you could send me a copy of your completed script, so we can check where we went wrong? Thanks!

  • @siriotorres2569
    @siriotorres2569 7 ปีที่แล้ว

    i need do something like this but for all screen the pivot is the character for this case how i can adjust for all moviles then =0

  • @dusansimic1907
    @dusansimic1907 5 ปีที่แล้ว

    Thanks, this was veeeeeeery helpful!

  • @_storm_715
    @_storm_715 4 ปีที่แล้ว

    Thank you! This code works just cool!

  • @MuttleyGames
    @MuttleyGames 6 ปีที่แล้ว

    Very helpful but how can i make the tap be as Input.GetMouseButton and not Input.GetMouseButtonDown

  • @EduardRo1
    @EduardRo1 7 ปีที่แล้ว

    nice! your are the best...
    I have a question: it is possible in unity to make a game where USER 1 press one button and USER 2 can see the images from USER 1 phone camera, same with live streaming ?

  • @debonairlivestreams9997
    @debonairlivestreams9997 5 ปีที่แล้ว +1

    Any suggestions?

  • @HAMZA-ef9gw
    @HAMZA-ef9gw 6 ปีที่แล้ว +1

    Great Work but please can you add this script in website? because it takes alot of time to build script like that.

  • @debonairlivestreams9997
    @debonairlivestreams9997 5 ปีที่แล้ว +1

    Thanks. I figured it out. Now i have to figure out how to get the model to animate on the swipe.

    • @zachvandyke9528
      @zachvandyke9528 4 ปีที่แล้ว +1

      Hey, me and my friend are really struggling to get this figured out. Is there anyway you could send me a copy of your completed script, so we can check where we went wrong? Thanks!

    • @debonairlivestreams9997
      @debonairlivestreams9997 4 ปีที่แล้ว +1

      @@zachvandyke9528 I'm hoping this comment isn't considered spam but I have a small tutorial placed on one of my channels. th-cam.com/video/pGinQ3IbtME/w-d-xo.html

  • @chrisprincipal19
    @chrisprincipal19 5 ปีที่แล้ว

    How do I make the ball travel farther with a swipe? It moves very little :(

  • @mhf169
    @mhf169 5 ปีที่แล้ว

    thanks dude....it was awesome

  • @footballreview-5160
    @footballreview-5160 3 ปีที่แล้ว +1

    Why doesn't it work for me?

  • @IPhonixI
    @IPhonixI 4 ปีที่แล้ว

    can you create a piano tiles game too? its so hard to synce a music with the buttons

  • @carterghiglieri5943
    @carterghiglieri5943 4 ปีที่แล้ว +3

    Is there away of downloading this code, Ive tried to copy it a couple times, but I keep getting something wrong

    • @hakata8889
      @hakata8889 4 ปีที่แล้ว

      Maybe it is better to just know how to wright it yourself

  • @jorgemedina8497
    @jorgemedina8497 3 ปีที่แล้ว

    Awesome video

  • @Нэтиксон
    @Нэтиксон 3 ปีที่แล้ว

    Nice man!

  • @platyplayer5615
    @platyplayer5615 6 ปีที่แล้ว

    how can I apply this to newly spawned prefabs? how can I adjust the amount it moves also? Thank you so much for the tutorial though!!!!

  • @РусланРепецкий-б9и
    @РусланРепецкий-б9и ปีที่แล้ว

    how to do if the cube returns to zero coordinates?

  • @Lav_A
    @Lav_A 4 ปีที่แล้ว

    Where did you get the Swipe Test script please ?

    • @headshot4256
      @headshot4256 4 ปีที่แล้ว

      th-cam.com/video/rDK_3qXHAFg/w-d-xo.html

  • @beautybeastmodetraining2999
    @beautybeastmodetraining2999 7 ปีที่แล้ว

    Hello. It seems as though my player is like shaking when I go to test out my scripts. It does work but it looks likes its jerking. Oh, and is there a way for it to move faster.
    Sorry for the multiple questions.
    I really appreciate your tutorial. It helped me out a lot.

  • @shadowplayer7774
    @shadowplayer7774 5 ปีที่แล้ว

    how do i set up the empty game object

  • @kordou
    @kordou 6 ปีที่แล้ว +2

    thnks for this tutorial :)
    for some reason my cube goes down left ...I double checked the code but i cannot see any errors. any idea ? thnks

    • @aadityakiran_s
      @aadityakiran_s 4 ปีที่แล้ว +2

      Yeah me too, same error. Didn't get a reply yet? Wow

    • @user-pw5do6tu7i
      @user-pw5do6tu7i 4 ปีที่แล้ว

      @@aadityakiran_s same, up and down is wonky

  • @tharothrong3964
    @tharothrong3964 6 ปีที่แล้ว

    I have a 2d space shooter, but when i applied this code it only move player onc direction at a time. Can i make my player move as long as i drag the screen

    • @rustclip
      @rustclip 6 ปีที่แล้ว

      can you send me the code?

  • @silentgamer2555
    @silentgamer2555 4 ปีที่แล้ว

    i need some help plzz
    errors
    error CS1061: 'SwipeTest' does not contain a definition for 'SwipeLeft' and no accessible extension method 'SwipeLeft' accepting a first argument of type 'SwipeTest' could be found (are you missing a using directive or an assembly reference?)
    error CS1061: 'SwipeTest' does not contain a definition for 'SwipeRight' and no accessible extension method 'SwipeRight' accepting a first argument of type 'SwipeTest' could be found (are you missing a using directive or an assembly reference?)
    error CS1061: 'SwipeTest' does not contain a definition for 'SwipeUp' and no accessible extension method 'SwipeUp' accepting a first argument of type 'SwipeTest' could be found (are you missing a using directive or an assembly reference?)
    error CS1061: 'SwipeTest' does not contain a definition for 'SwipeDown' and no accessible extension method 'SwipeDown' accepting a first argument of type 'SwipeTest' could be found (are you missing a using directive or an assembly reference?)

    • @silentgamer2555
      @silentgamer2555 4 ปีที่แล้ว

      i eplaced swpietest with SwipeControls in SwipeTest Scripts in (7,16)
      4 errors removed

  • @TheStrandedMoose
    @TheStrandedMoose 5 ปีที่แล้ว +1

    Thanks for the tutorial! I'm having an issue with the tap though.
    In my game, I set tap to jump, but swipe to change direction. Now the problem is, every time I change direction, the character jumps as well because you set tap= true... Do you know how I would fix it?

    • @MrDarkAdiel
      @MrDarkAdiel 5 ปีที่แล้ว

      Did you find a solution?

    • @TheStrandedMoose
      @TheStrandedMoose 5 ปีที่แล้ว +1

      @@MrDarkAdiel Yep! Just had to set a tapRequest bool = to true when the player first puts down their finger. Then if the swipe exceeds a magnitude, set tapRequested to false. Then on mousebuttonup, and touchphase.ended, i check if tapRequested is still true. If so it was a tap and not a swipe, so I set tap = true. If not, it was a swipe.

  • @eastercat
    @eastercat 7 ปีที่แล้ว

    Is this code put up in a github or website?

  • @Atlas-st1yt
    @Atlas-st1yt 3 ปีที่แล้ว

    help me please, player, when swiping goes through objects

  • @azlantg
    @azlantg 5 ปีที่แล้ว +21

    DO NOT USE THIS - IT IS OUTDATED AND DOES NOT WORK PROPERLY BY PRINCIPLE - see the end where tap and swipe are triggered together.

    • @geoss4562
      @geoss4562 4 ปีที่แล้ว +4

      oh fuck finished the whole thin and now read your comment. What exactly is outdated and how would you improve it?

    • @onurozulku4314
      @onurozulku4314 4 ปีที่แล้ว +1

      @@geoss4562 i use that code but idk how can i fix this problem
      i wanna add jump to the touch.began but swipe code trigger jump too

    • @chrisp2554
      @chrisp2554 4 ปีที่แล้ว +1

      Had problem here too. The player will not parent properly to a moving platform. And once the player detaches he starts sliding on the platform

    • @HexerMain
      @HexerMain 4 ปีที่แล้ว

      It does. You simply need to slightly adjust the code!

    • @azlantg
      @azlantg 4 ปีที่แล้ว +1

      @@HexerMain a beginner wouldnt know how to do that. Also you shouldn't have to adjust the code for it to work when following a tutorial.

  • @poolplayer322
    @poolplayer322 7 ปีที่แล้ว

    Hey man thank you for the tutorial! Very well done. Have you tried to incorporate these swipe functions with ARKit? I tried and Im getting funky results.

  • @Samotnick1
    @Samotnick1 7 ปีที่แล้ว

    This is great tutorial. I was killing myself over it but thanks to You its all come more clear :). Just one question: how to stop player to move over screen?? i try to Mathf.Clamp but probably I do something wrong??

  • @bechantrau3933
    @bechantrau3933 3 ปีที่แล้ว

    "magnitude>125" what does it mean? Can someone explain this to me please?

  • @abhisarsharma7612
    @abhisarsharma7612 5 ปีที่แล้ว

    How do i disable tap when i am swiping
    please help

  • @shaoorparacha1852
    @shaoorparacha1852 5 ปีที่แล้ว +1

    awesome work very helpful
    those who have an error of the cube move to the position (0,0,0) write the simple two line code in swipeTest script only make the void start and assign the position to the desired position
    private void Start()
    {
    desiredPosition = player.transform.position;
    }

    • @EnglishBloke1
      @EnglishBloke1 5 ปีที่แล้ว

      How do I do this? New to coding and only follow tutorials.

  • @satriales234
    @satriales234 7 ปีที่แล้ว +2

    Thanks for this! Just yesterday I was trying to get swipe working and gave myself a headache trying to figure it out, but you make it all so easy.

  • @__.ut__
    @__.ut__ 6 ปีที่แล้ว +1

    This doesnt work for Vuforia based app

  • @bugraates478
    @bugraates478 4 ปีที่แล้ว +1

    Sometimes i press ctrl + s while watching video :)

  • @umarbaloch7811
    @umarbaloch7811 6 ปีที่แล้ว

    does it works on mobile touch

  • @ancolia8772
    @ancolia8772 3 ปีที่แล้ว

    8:50 trynna figure out what unplugged

  • @RelaxingPirate
    @RelaxingPirate 7 ปีที่แล้ว

    This really helps, but there is something I wanted to ask N3K EN. I am created something similar to the ball throw you will find on Pokemon go. I have most of it complete already. for example, I have a ball that follows the players finger and swipe to throw. However, if they slowly touch and move the ball, the throw functions will still fire off. I notice in Pokemon go, even with a fast swipe, it will not throw the ball unless it was a fast swipe plus release. You can do a slow drag into a fast flick with a release and it also works. I would like my game to work like that. Help?

    • @RelaxingPirate
      @RelaxingPirate 7 ปีที่แล้ว

      It seems to reset the swipe begin position each frame, unless the swipe speed reach a certain #. I do not know if it is possible to get swipe speed

  • @Sir_kryszo
    @Sir_kryszo 4 ปีที่แล้ว

    Please do a tutorial on it pushing another cube

  • @jasonoctane4787
    @jasonoctane4787 4 ปีที่แล้ว

    Anybody have this script? I tried it and there are errors. Seems like the vid was edited and changed things off camera

    • @HexerMain
      @HexerMain 4 ปีที่แล้ว

      Yeah I do. If you still want it, have a look at this:
      drive.google.com/file/d/1aI91rUcDESY6gXbPig8_3ROVvC1KlaHu/view?usp=sharing

  • @fairgame9990
    @fairgame9990 6 ปีที่แล้ว

    Anybody figure out why the game object moves to the middle and how to fix it?

  • @youssefazaaz
    @youssefazaaz 7 ปีที่แล้ว

    Can you make a tutorial on how to control the rotation of an object by touching the left and right side of the phone.

    • @OscarTorresWork
      @OscarTorresWork 7 ปีที่แล้ว

      Youssef Azaaz check out Holistic 3d she lready covered that 😊👊

    • @youssefazaaz
      @youssefazaaz 7 ปีที่แล้ว

      Can you please leave a link? Thanks BTW

  • @khaledosman6369
    @khaledosman6369 7 ปีที่แล้ว

    can anyone plz upload to anywhere the script,i am not lazy I have already wrote it but having always problems!!and if anybody knows how to add force when swiping plz plz

  • @pravinkr3915
    @pravinkr3915 5 ปีที่แล้ว

    this code will work for 2D?

  • @seimoun
    @seimoun 6 ปีที่แล้ว +5

    My cube always goes to 0, 0, 0 and stays there

    • @PromiseSoul648
      @PromiseSoul648 6 ปีที่แล้ว +1

      me too ! have you found a solution?

    • @lemetamax
      @lemetamax 6 ปีที่แล้ว +1

      I have the same problem. The game object goes to 0, 0, 0 first before accepting any touch. I think it is because of the player.transform.position line in the Controls script(1st script).

    • @papakipari-27
      @papakipari-27 6 ปีที่แล้ว

      i have faced same prob but i have use new script on camera its working ok
      transform.position = player.position + offset; set the offset value x= 0, y=1 , z =5

    • @papakipari-27
      @papakipari-27 6 ปีที่แล้ว

      @@PromiseSoul648 i have faced same prob but i have use new script on camera its working ok
      transform.position = player.position + offset; set the offset value x= 0, y=1 , z =5

    • @papakipari-27
      @papakipari-27 6 ปีที่แล้ว

      @@lemetamax i have faced same prob but i have use new script on camera its working ok
      transform.position = player.position + offset; set the offset value x= 0, y=1 , z =5

  • @Black2Ninja1
    @Black2Ninja1 5 ปีที่แล้ว

    This script solve my problem Thanks for the help

  • @Ascaron50
    @Ascaron50 6 ปีที่แล้ว

    Can't you just use get; private set; ?

  • @Axasts
    @Axasts 7 ปีที่แล้ว

    So usefull!! Thx

    • @n3ken
      @n3ken  7 ปีที่แล้ว

      Glad it helped :D

  • @khokh699
    @khokh699 6 ปีที่แล้ว

    it doesn't let me select the swipe script into the swipe test script?

    • @daskannsein1861
      @daskannsein1861 6 ปีที่แล้ว

      I have the same Problem right here

  • @pankjmalviya1474
    @pankjmalviya1474 7 ปีที่แล้ว

    Thank You so much :)

  • @mahrmudasser8354
    @mahrmudasser8354 7 ปีที่แล้ว +3

    Hey .. Greetings from Pakistan.. I am a beginer yet. I am trying to make a 2d shooting game. which will shoot in all direction except downwards. will this code work for all directions either it is swiped in diagonal ??? Waiting for you response as soon as possible.

    • @Jordan-9595
      @Jordan-9595 6 ปีที่แล้ว

      I second this

    • @MrYanissab
      @MrYanissab 4 ปีที่แล้ว

      Did you figure it out ?

  • @SatyaPrakash-po3zp
    @SatyaPrakash-po3zp 6 ปีที่แล้ว

    You are Amazing !!!