Method that recognizes the touch of the MOBILE SCREEN C#

Asked

Viewed 1,075 times

3

I’m doing an augmented reality app with Unity and vuforia. I created a class that makes the ball bounce, now I need to insert this ball movement to a touch on the mobile screen... Does anyone know any method that identifies this touch?

  • I think it might help you. https://software.intel.com/pt-br/articles/developing-windows-8-desktop-touch-apps-with-windows-presentation-foundation

  • Joana, it’s always ideal that you go through what you tried to do to achieve your goal, even though it’s not working. This way your question is more likely to be answered.

  • I didn’t code because I didn’t have any Tulio.

1 answer

4


This is an example taken from a site tutorial unity3d.

using UnityEngine;
using System.Collections;

public class TouchTest : MonoBehaviour 
{
    void Update () 
    {
        Touch myTouch = Input.GetTouch(0);

        Touch[] myTouches = Input.touches;
        for(int i = 0; i < Input.touchCount; i++)
        {
            //Do something with the touches
        }
    }
}

You can pick up the touch coordinates by the instance of Touch which in the example is called myTouch and see if they collide with the ball you have on the screen. That for example is for you to iterate on the ringtones, if more than one ringtone has occurred at the same time.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.