Log in or register to post comments

3d object in front of ARCamera

December 20, 2014 - 7:06am #1

Hi folks,

I'm not sure where to post this, so I hope this location is ok.

This is my issue:

- in unity I create a plane in front of the camera (centered to the viewport), in the game view it fits exactly. I am using a landscape mode.

- as soon as I press play the camera seems to zoom in on the plane and the plane no longer fits the viewport.

I saw it might be related to vuforia needing to stretch the camera image or something like that, but vuforia says the video feed is 640x480, which is exactly the resolution I used to position everything.

What is causing this and how can I fix it? Right now I am using this method to recalculate the fov the ARCamera is using to reposition my objects:

        Vector3 worldPoint = QCARManager.Instance.ARCamera.ScreenToWorldPoint(new Vector3(0, 0, 10));
        Vector3 localPoint = QCARManager.Instance.ARCamera.transform.InverseTransformPoint(worldPoint);
        float halfFov = Mathf.Atan2(localPoint.y, localPoint.z);
 

It results in an fov that is different than that what the editor is showing, but it actually works.

It seems like such a basic thing: position something in front of the camera and make it fit the viewport?

I need this functionality because I want to move objects from the marker space to the camera space and back again.

Thanks in advance for better ideas!

Hans

 

 

3d object in front of ARCamera

January 18, 2015 - 9:50am #5

Hi Alessandro,

thanks for the info! Much appreciated!

best,

Hans

3d object in front of ARCamera

January 11, 2015 - 12:41pm #4

Vuforia sets the camera projection matrix using its own perspective and fov (the actual fov used is a fairly accurate representation of the actual device camera optics);

however, the actual FOV returned by Unity via camera.fieldOfView does not correspond to the actual Fov used by Vuforia at runtime; if you are looking for the actual FOV value used by Vuforia, you need to:

- get the unity camera projection matrix ==> see: http://docs.unity3d.com/ScriptReference/Camera-projectionMatrix.html

- derive the actual FOV (in radians) from the projection matrix, using standard projection matrix maths

 

3d object in front of ARCamera

January 10, 2015 - 6:07am #3

Hi David,

I'm seeing on asus google nexus devices. I was assuming that even if vuforia overrides the vof, that I could update to the value vuforia is using by just reading it out through code.

best,

Hans

3d object in front of ARCamera

December 22, 2014 - 11:41am #2

Vuforia overrides the FOV setting in the editor, so don't go by that value. Which devices are you seeing the effect on?

Log in or register to post comments