Search Unity

Swipe Detection and GVRController

Discussion in 'Daydream' started by Mystic_nynja, Nov 4, 2016.

  1. Mystic_nynja

    Mystic_nynja

    Joined:
    Feb 5, 2013
    Posts:
    14
    Hey Everyone,

    Just a quick question about swipe detection. I want to be able to make my character roll, lunge, etc when the player swipes on the touchpad. I know how to do this, but just was wondering if there was some Native TouchController endpoint I can query to ask if it was a touch swipe or click on the touchpad.

    If not I will create my own. With that being said would I use the Input class to get the necessary information? (Input.GetTouch())

    Thanks
    Will
     
  2. mira_leung

    mira_leung

    Official Google Employee

    Joined:
    May 17, 2016
    Posts:
    70
    Hi Will,

    We currently don't have swipe detection in the SDK, but you can roll your own by doing the following:
    • In Update(), if GvrController.IsTouching, start tracking touches and save GvrController.TouchPos locally.
    • If !GvrController.IsTouching, then you have a Vector2 touchDelta = GvrController.TouchPos minus the one saved above.
    • Do logic based off the above.
    Of course, there are lots more use cases, but this should hopefully get you started. :)

    Thanks,
    Mira
     
  3. Eiseno

    Eiseno

    Joined:
    Nov 1, 2015
    Posts:
    86
  4. fmielke

    fmielke

    Joined:
    Oct 17, 2016
    Posts:
    35
    According to the swipe question a more advanced one: is there anything planned for gesture recognition? Fore example circles or numbers? Or should we do it on our own, or use common algorithms (anyway)?
     
  5. UmairEm

    UmairEm

    Joined:
    Nov 7, 2015
    Posts:
    31
    Another related question: Does controller work with scrolls by default ?

    1. point at scrollRect UI object
    2. click and hold.
    3. drag down (or any other direction based on scollRect's scroll direction)
    4. release click

    does this scroll the scroll rect? or do I have to implement pointer handler interfaces to achieve that?

    Thanks
     
    fmielke likes this.
  6. fmielke

    fmielke

    Joined:
    Oct 17, 2016
    Posts:
    35
    @UmairEm I tried it and scrolling in scroll Rects does not work by default. I think it is useful to open a new thread for that problem. If you solved it, please tell me how. Thank you!
     
  7. UmairEm

    UmairEm

    Joined:
    Nov 7, 2015
    Posts:
    31
    I haven't been able to solve this yet. And I am not sure if this is a right platform for development questions as this thread is in Betas & Experimental category. I have created a thread in Virtual Reality forum
     
    Last edited: Dec 15, 2016