c# - Get markers position in Vuforia


Keywords:c# 


Question: 

I use vuforia in Unity for marker recognition and tracking. I need to get the positions of several markers, in order to add 3D objects in the same positions in another scene (without vuforia)

So my main goal is to get the marker's position.

The problem is, that the way Vuforia works is strange :(

If I use one marker (ImageTarget) - the marker is actually staying in place while the camera is moving around it. If I use 2 markers - 1st marker remains in place, the camera moves around it, but the second marker also moves!

So if I see ony 1 marker - I should somehow recalculate the marker's position relative to the camera. If I see 2 or more markers, I have moving marker and moving camera and there should be some more complex calculatins.

So what should I finally do to get all the marker's position in this case?


1 Answer: 

From what you are saying I guess your current WorldCenterMode is set to FIRST_TARGET. This means that the first target that detects will not move because is set to be the center of the world, i.e. position (0,0,0).

As you can see in the documentation you have a couple of other options, but essentially Vuforia needs a way to map a real-world position to a unity-world position.

In your case I think you can use the CAMERA mode and set the other scene's camera at position (0,0,0). In this way, just copying the marker's position should do the trick.