Log in or register to post comments

About mixed marker types and world center

February 5, 2014 - 2:13pm #1

Hello,

me again, duuuuuhhh yes i know.

So our setup requires a lot of Phyiscs (Bad idea, i know), thus our scenes need to be Marker centric, so the main object remains static (not moved by vuforia).

While this would be easy to do in one scene where i can connect ARCameras Qucarbehaviours World Center Mode to a specific target, it is not easy any more under these conditions:

1. Camera is set to keep alive, thus i cannot set World Center Targets in the editor (because we want to load a lot of different scenes)

2. As long as their are only imageMarkers involved, the initial setting to World Center Mode FIRST_TARGET works well.

3. Now my team mates had the idea to include Framemarkers (only one so far) which can be thrown into the view while any scene plays.

Their content is a simple 3D object with a BoxCollider. When you hit it, a UIWebview will be openend and loads someting.

In the meantime Unity is paused. When you return to unity after this, it seams the whole setup inits again, but now there is a posibility that this Framemarker becomes the FIRST_TARGET, thus, this Object is static, but the object with the main Imagemarker will be moved.

And this is really an earthquake to Physics in the end.

 

I tried to set the World Center by script like so:

public static void setWorldCenter(TrackableBehaviour theTrackable) {
		if (theTrackable == null) {
			Debug.LogError("setWorldCenter theTrackable is null");
			return;
		}
		Debug.Log ("setWorldCenter to ", theTrackable);
		Debug.Log ("qcarbehaviour " + qcarbehaviour);
		if (qcarbehaviour == null) {
			Debug.LogError("qcarbehaviour ist null ");
			GameObject arCam = GameObject.Find ("ARCamera");
			if (arCam) {
				Debug.Log ("arCam was found ", arCam);
				qcarbehaviour = arCam.GetComponent<QCARBehaviour>();
				Debug.Log ("qcarbehaviour " + qcarbehaviour);
			}
		}

		//qcarbehaviour.SetWorldCenterMode(QCARAbstractBehaviour.WorldCenterMode.SPECIFIC_TARGET);
		Debug.Log ("set Worldcenter to ", theTrackable.transform);
		qcarbehaviour.SetWorldCenter(theTrackable);

		//In the end it seams, we cannot set worldcenter,
		//and there is no way to get a result for the operation
		Debug.Log ("center is" + qcarbehaviour.WorldCenter);
	}

 

But it was never set. Remained null. I cannot understand this, because when using just your prefabs, some marker WILL be the FIRST_Target of a scene, thus, the AR CAMERA (which is under Keep alive) WILL change its center.

Why cant i do this by script then?

Or in short words:

How can i prevent certain Trackables from becoming first_target?

 

About mixed marker types and world center

February 6, 2014 - 11:40am #4

OK, I understand what you are trying todo; so, it seems you could be ok if you were able to "exclude" a specific target (for instance the framemarker) from becoming a FIRST_TARGET;

unfortunately this is not possible, by design; so, here I don't see an obvious solution to your use case.

 

About mixed marker types and world center

February 6, 2014 - 10:19am #3

Yes, i know this, but this works only in one scene, where ARCamera and the Imagetarget are both present.

I our case however, the ARCamera is set to keep alive and other Scenes with always different imageMarkertargets are loaded.

So i cannot connect to a Specific target.

Setting the ARCamera to use FIRST_Target is fine as long as only as after scene switching there is only one printed Marker on View.

But if there is a framemarker also in view, this might become First target.

And yes all this would be fine if there were no physics objects involved.

About mixed marker types and world center

February 6, 2014 - 3:04am #2

If I undrestand your problem correctly, I think you should use World Center Mode = SPECIFIC_TARGET (instead of FIRST_TARGET), because FIRST_TARGET means the world center will always be set by Vuforia automatically to the first target that is detected in the camera view;

SPECIFIC_TARGET on the other hand, allows you to specify a specific Image target to which you want to anchor your view.

So, that's probably the option you want to go with.

Note, however, that if the "specific target" is not found in the camera view, and another one is found, the World will be centered to the latter, as a fallback.

 

Log in or register to post comments