Log in or register to post comments

Loading URL once click object

August 5, 2012 - 1:26pm #1

I have a problem....

I  manage to fix so far and make the AR cam to detect the URL but the prob is as soon as the camera is on... no matter where i click, it goes to the URL....

How can i make the URL to work upon the object loading from the marker n clicking on it to load the URL pls... 

i named the object as www.google.com and made a box collider and checked the "is trigger"on....
 
what am i missin pls?

the code i'm using is this 

 

 

using UnityEngine;

using System.Collections;

 

public class selectObject : MonoBehaviour {

 

void Update () 

{

 if (Input.GetKeyDown("escape"))

            Application.Quit();

 

      TapSelect(); 

}

 

void TapSelect() 

{

    foreach (Touch touch in Input.touches) 

{

        if (touch.phase == TouchPhase.Began) 

{

            Ray ray = Camera.main.ScreenPointToRay(touch.position);

            RaycastHit hit;

            if (Physics.Raycast (ray, out hit)) 

{

Application.OpenURL (hit.collider.gameObject.name);

              

         }

        }

    }

}

}

 
 

Loading URL once click object

August 6, 2012 - 1:43am #4

then do Tabselect() only if Trackable was found.

Loading URL once click object

August 5, 2012 - 1:40pm #3

by the way... as soon as the marker pops out the object... it works like normal ... wen i click object it takes me to URL but if i click anywher else... no effect and this works like a charm...

but the prob is before the marker is detected, when the camera app is started... where ever i click... it takes me directly to the URL....

Loading URL once click object

August 5, 2012 - 1:34pm #2

this is the code i'm using

 

using UnityEngine;

using System.Collections;

 

public class selectObject : MonoBehaviour {

 

void Update () 

{

 if (Input.GetKeyDown("escape"))

            Application.Quit();

 

      TapSelect(); 

}

 

void TapSelect() 

{

    foreach (Touch touch in Input.touches) 

{

        if (touch.phase == TouchPhase.Began) 

{

            Ray ray = Camera.main.ScreenPointToRay(touch.position);

            RaycastHit hit;

            if (Physics.Raycast (ray, out hit)) 

{

Application.OpenURL (hit.collider.gameObject.name);

              

         }

        }

    }

}

}

 
Log in or register to post comments