Log in or register to post comments

Unity (bool and OnTrackingFound)

June 19, 2015 - 10:36am #1

Hello I am trying to do some super simple.

I want to change the value of a bool to true when the targets are found.

But for some it refuse to change the values to true, keep in mind i am introducing each target at different times.

 

 

public class test : MonoBehaviour {

	// vuforia code misssing

	public bool foundChipA;
	public bool foundChipB;
	

	private void OnTrackingFound()
	{
			// vuforia code misssing

		Debug.Log("Trackable " + mTrackableBehaviour.TrackableName + " found" + "\n");

		
		if (mTrackableBehaviour.TrackableName == "Chip_a")
		{
			foundChipA = true;
		}

		if (mTrackableBehaviour.TrackableName == "Chip_a")
		{
			foundChipB = true;
		}


		if (foundChipA == true && foundChipB == true)
		{
			print("Chip a and Chip b are found");
		}

}

 

Unity (bool and OnTrackingFound)

August 16, 2018 - 8:10am #5

I have the exact same problem! The first target found changes to TRUE. As soon as the second target is scanned along with the first one still being scanned, (Both images are being detected by vuforia)the first one will automatically changes to FALSE.

Did you manage to fix this issue please?

Unity (bool and OnTrackingFound)

June 29, 2015 - 10:28pm #4

I could reset it but in this case i want to stay true for the duration of the experience. You are right i about trackiable name but if you run something like this:

 

string nameTarget = mTrackableBehaviour.TrackableName

print ("found:" + nameTarget)

it will return something different everytime it finds a new target.

 

so it seems it's smart enough to know the differents of every target.

Thoughts? 

Unity (bool and OnTrackingFound)

June 25, 2015 - 8:00pm #3

i try to but i can't change a bool to true in OnTrackingFound(); i use unity 5.1.01p, how can implement in a new script?

public bool aux=false;

Void OnTrackingFound(){

aux true?

}

Unity (bool and OnTrackingFound)

June 21, 2015 - 3:28pm #2

You're comparing the trackablename in both cases to "Chip_a", so if you're scanning "Chip_b" it won't have any effect.

If you scan "Chip_a", I'd expect both booleans to be set.

Also, are you resetting the bools at any point (eg. in OnTrackingLost)?

Log in or register to post comments