First, thanks for this fantastic unity3d extension.
I am using qcar ( the new beta ) for an ar project with unity3d on iPad.
I want to connect a gui element with a linerenderer to an object in the scene.
I have the gui texture position and want to convert this to a position in space. ( startPosition of my linerenderer. It is not so important if this is a linerenderer or whatever, I just need that one position)
The startPosition of my line is not as expected.
What did I try:
I tested in unity editor with a modified camera matrix and my code worked for that. Testing my scene on an iPad, the line did not connect to the startPosition. It points to positions far off, more or less, depending on how I point to the marker.
The world center mode is set to user.
I use this code in a loop:
Vector3 tPos = guiLabel.transform.position;
float tX = (tPos.x * Screen.width);
float tY = (tPos.y * Screen.height);
// the 10 for the z val is hardcoded, I have no idea how get the nearClipping for the matrix manipulated camera
Vector3 screenPos = new Vector3(tX ,tY, 10);
Vector3 StartPos = Camera.mainCamera.ScreenToWorldPoint(screenPos);
StartPos = Camera.mainCamera.worldToCameraMatrix * StartPos;
// update my linerenderer
lineComponent.SetPosition (0, StartPos);
// targettrans is a 3d object in the world, this is no problem
lineComponent.SetPosition (1, targetTrans.position);
So, any hints, ideas?