__Tocuh button script Help

http://gringofxs.webs.com/one.jpg
http://gringofxs.webs.com/two.jpg

I have a GUItexture button. and a 3d object that appear and desapear over the image TRACK, with the touch of the GUItexture button in the screen. The problem is that when im not over the image TRACK, if i touch the GUItexturebutton, the object appear in the scene and it supouse to do not appear, to work only with the image TRACK.

here is the code. How can i fix that code in order to work just with the imageTRACK.


var myObject : GameObject;

function Start(){
myObject = GameObject.Find(“teapot”);
}

function Update () {
if (Input.touchCount > 0 Input.GetTouch(0).phase == TouchPhase.Began){
if (guiTexture.HitTest(Input.GetTouch(0).position)){
myObject.renderer.enabled = !myObject.renderer.enabled;
}
}
}

Where did u put this script? And by image track u mean the unity logo right?

I put the script in the unity GUITexture button, and the image track is this. http://gringofxs.webs.com/two.jpg

is a vuforia AR project for unity.

try this, make a new variable (GUITexture) and place the texture in it
var My_Texture : GUITexture;
and place the texture in there and then use this:

if (My_Texture.HitTest(Input.GetTouch(0).position)){

like this?

var My_Texture : GUITexture;
var isTracking : boolean;
var myObject : GameObject;
var myName : String = “teapot”;
function Start(){
myObject = GameObject.Find(myName);
}

function Update () {
if (Input.touchCount > 0 Input.GetTouch(0).phase == TouchPhase.Began){
if (guiTexture.HitTest(Input.GetTouch(0).position)){
myObject.renderer.enabled = !myObject.renderer.enabled;

if (My_Texture.HitTest(Input.GetTouch(0).position)){

}
}
}

}

Like this:

function Update () 
{
if (Input.touchCount > 0  Input.GetTouch(0).phase == TouchPhase.Began)
{
if (My_Texture.HitTest(Input.GetTouch(0).position))
{
myObject.renderer.enabled = !myObject.renderer.enabled;
}
}
}

i did that, but still the same, the Guitexture button work outside and inside the image track, enable and disable the (teapot) 3d object. I need the Guitexture button just work showing and hiding the (teapot) 3d obj when the image track is in the front.

var My_Texture : GUITexture;
var myObject : GameObject;
var myName : String = “teapot”;
function Start(){
myObject = GameObject.Find(myName);
}

function Update ()
{
if (Input.touchCount > 0 Input.GetTouch(0).phase == TouchPhase.Began)
{
if (My_Texture.HitTest(Input.GetTouch(0).position))
{
myObject.renderer.enabled = !myObject.renderer.enabled;
}
}
}

Here is the problem, i put in a video.