Search Unity

tap on Sprite in AR foundation

Discussion in 'AR' started by XRDigitech05, Mar 1, 2019.

  1. XRDigitech05

    XRDigitech05

    Joined:
    Feb 14, 2019
    Posts:
    4
    hi
    i am new for AR Foundation and want to work on it.
    i want to perform some task on tap of sprite with ray-casting in AR foundation(Ar kit) like i have multiple sprite n i want to use them as a button.
    Please help me how i will do it....
    Thanks in advance
     
  2. underkitten

    underkitten

    Joined:
    Nov 1, 2018
    Posts:
    30
    Make sure your sprites have Colliders and then you can do something like this in Update function:

    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
    {
    *button action*
    }
     
  3. XRDigitech05

    XRDigitech05

    Joined:
    Feb 14, 2019
    Posts:
    4
    Thanx@underkitten