Log in or register to post comments

Incorrect scale set by ImageTarget

January 26, 2013 - 8:33am #1

Vuforia SDK Version: vuforia-unity-android-ios-2-0-30.unitypackage -

Description with steps to reproduce: If this code is used to create an Image Target at runtime, the scale is set incorrectly for the game object in Unity:

string dataSetName = "QCAR/ImageTargets.xml";
DataSet.StorageType storageType = DataSet.StorageType.STORAGE_APPRESOURCE;
dataSet = imageTracker.CreateDataSet();
dataSet.Load(dataSetName, storageType);
imageTracker.ActivateDataSet(dataSet);
StateManager stateManager = TrackerManager.Instance.GetStateManager();
foreach(TrackableBehaviour tb in stateManager.GetTrackableBehaviours()){
tb.gameObject; //the scale of this game object is 200, which is incorrect -

Development OS (Mac OS X, Windows, Linux): W -

Mobile OS and Version: NA -

Mobile Device Manufacturer and Model name: NA -

Do the Vuforia Sample Applications show the same behavior?:

Incorrect scale set by ImageTarget

March 2, 2013 - 3:44am #14

Thanks. It works now.

Incorrect scale set by ImageTarget

March 1, 2013 - 2:20am #13

Hi Elecman,

quick updtae: Vuforia 2.0.31 is out. It should include the fix for the Incorrect scale issue.

Incorrect scale set by ImageTarget

January 30, 2013 - 2:09am #12

Yes. The fix for the other bug you mentioned is also expected in the same release.

Incorrect scale set by ImageTarget

January 29, 2013 - 4:09pm #11

Great! Hopefully the bug resulting in code generated frame markers not being detected will be resolved in that release as well.

Incorrect scale set by ImageTarget

January 29, 2013 - 7:24am #10

Quick update: the issue has been solved. The fix should be available with the next maintenance release (expected soon).

 

Incorrect scale set by ImageTarget

January 29, 2013 - 2:36am #9

Sorry, I was testing on device (while in PlayMode I do see the new targets);

you're right, the issue is showing up, the scale is incorrectly set to 200;

I've brought this to the team (like the other ones you spotted), we are looking into it.

 

 

Incorrect scale set by ImageTarget

January 29, 2013 - 2:19am #8

Weird.I do see it in the Editor if I generate it in code. As far as I understand, a marker (image target or frame marker) is a game object with an ImageTargetBehaviour or MarkerBehaviour script attached to it. By defenition, game objects are visible in the Editor in Unity. 

To clarify. The way Vuforia is setup, there is no such thing as a marker without a game object. A marker IS a game object, whether programatically created or not. And a game object has a scale. So the behaviour script attached to the game object might have the correct scale variable, but the game object itself has an incorrect scale.

Are you sure you can't see the marker in the Editor? Have a look at the UCS beta I mailed to David. Go to the Vuforia script and disable my bugfix for this issue in the function CheckInit(). This is the bugfix:

//Bugfix: due to a Vuforia bug, the scale is set incorrectly, so set it here. 
//It seems that you have to select the marker object in the Editor at runtime for this bug to show up...
for(int i = 0; i < markerAmount; i++){

	if(markerObjects[i].transform.localScale.x == 200.0f){
			
			markerObjects[i].transform.localScale = new Vector3(1.0f, 1.0f, 1.0f);
	}
}

Fire up the scene called VuforiaImageTargetsRuntime. In the Hierarchy expand the camera. There you will find my markers called "Marker Object 0", "Marker Object 1", etc. Click on it and you will see an incrorrect scale.

Incorrect scale set by ImageTarget

January 29, 2013 - 12:44am #7

Hi, there is a step that I miss; if I create the target programmatically (at run-time), I will not see it in the Editor...

Incorrect scale set by ImageTarget

January 28, 2013 - 11:41pm #6

The internal scale is indeed correct but have to click on the game object in the Hierarchy window in the editor for this bug to show up. Try it, you will see that the scale in the Inspector transform window suddenly changes if you do that

Incorrect scale set by ImageTarget

January 28, 2013 - 8:21am #5

Hi elecman,

I just tried to reproduce the issue, but I did not manage to get your erroneous behavior:

I have created a DataSet with one target of size <50, 35>, and then I used your code by putting it into a script attached to my ARCamera, as shown in the following code snippet:

public class TargetCreator : MonoBehaviour {
	
	private DataSet dataSet;
	
	// Use this for initialization
	void Start () {
		string dataSetName = "QCAR/ImageTargets.xml";
		
		ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER);

		dataSet = imageTracker.CreateDataSet();
		dataSet.Load(dataSetName, DataSet.StorageType.STORAGE_APPRESOURCE);
		
		imageTracker.ActivateDataSet(dataSet);
		
		StateManager stateManager = TrackerManager.Instance.GetStateManager();
		foreach (TrackableBehaviour tb in stateManager.GetTrackableBehaviours()) {
			Debug.Log("game object local scale: " + tb.gameObject.transform.localScale);
		}
	}
	
	// Update is called once per frame
	void Update () {
	
	}
}

When I check the logs, I see a scale which is correctly set to 50 in accordance with the XML.

Maybe should I make something different to make the problem appear ?

 

Incorrect scale set by ImageTarget

January 28, 2013 - 7:18am #4

Hi, thanks for the details.

(and no need to send me the UCS project, I can ask David, thanks.)

Incorrect scale set by ImageTarget

January 28, 2013 - 7:13am #3

The target size is this:

<ImageTarget size="0.27 0.171563" name="0"/>

I didn't try other sizes in the XML file yet but this bug is repeatble. I emailed the latest beta of UCS to David Beard. Let me know if you would like to have it as well.

Incorrect scale set by ImageTarget

January 27, 2013 - 2:13pm #2

Hi, you mention a DataSet called "ImageTarget.xml"; what is the target size (width and height) specified there ?

do you observe the same size (always 200) no matter what the size is in Image Targets ?

 

Log in or register to post comments