- Sort Posts
- 7 replies
- Last post
Help Touch ARcamera Playmaker
December 11, 2014 - 6:08am #1
im using Playmaker with Vuforia, i put a Touch Object Event to a Cube.
The problem is that with the ARcamera from Vuforia, i need to move very close to take effect the Touch Object Event. How can i expand or another way, to enable the Vuforia touch ARcamera, work at any position?
Help Touch ARcamera Playmaker
December 18, 2014 - 12:25am #6
void Update () { // test for touch if (Input.touchCount > 0) { // grab reference to this touch Touch userTouch = Input.GetTouch (0); // ray from cameara to point of finger touch Ray ray = Camera.main.ScreenPointToRay(userTouch.position); // hit object to record details of what was hit (touched) RaycastHit hit; // if we got a hit and it was on one of the gameobject if (Physics.Raycast (ray, out hit) && hit.collider.gameObject.name == "name of gameobject" ) { if (userTouch.phase == TouchPhase.Began) { } else if (userTouch.phase == TouchPhase.Moved) { } else if (userTouch.phase == TouchPhase.Ended || userTouch.phase == TouchPhase.Canceled) { } } } }
Help Touch ARcamera Playmaker
December 17, 2014 - 11:33am #5
Help Touch ARcamera Playmaker
December 17, 2014 - 3:39am #4
Head over to the Unkity forums as this is not a Vuforia related query, but...
// grab reference to this touch
Touch userTouch = Input.GetTouch (0);
// ray from cameara to point of finger touch
Ray ray = Camera.main.ScreenPointToRay (Input.GetTouch (0).position);
// hit object to record details of what was hit (touched)
RaycastHit hit;
// if the hit was on the Collider object
if (Physics.Raycast (ray, out hit) && hit.collider.gameObject.name == "Name of your object") { // do what you want}
Help Touch ARcamera Playmaker
December 16, 2014 - 7:50am #2
Hi,
you really shuld lookup this on the Unity forum, there are loads of examples plus the Vuforia examples have the same kind of this included too ;-)