Log in or register to post comments

Camera off center !

May 9, 2015 - 11:39pm #1

Vuforia SDK Version: 4.2.3 -

Description with steps to reproduce:


this happens in 4.2.3 but also in the 3 version.

Reproduce on a Asus Google Nexus 7 in Unity:

- setup arcamera (+ framemarker but that part doesnt even matter)

- add cube as child of ARcamera, exactly in front of ARcamera, exactly in center of ARcamera, eg (0,0, 5)

- press play in Editor -> screen is rendered with cube in center of screen as expected

- build for android device CAMERA_FRONT -> screen is rendered with cube in center of screen as expected, but I see myself which is scary

- build for android device CAMERA_BACK -> screen is rendered with cube of center, eg top of cube touches device screen top, but on the bottom there is space left (like couple of millimeters, but that of course depends on cube size). If you rotate the device 180, everything rotates ok, but now the space is at the top.

In other words the ARcamera (0,0,0) does not seem to be at (visible_screen.width/2, visible_screen.height/2), and neither at (screen.width/2, screen.height/2)


I need to position objects exactly in front of the camera, aligned with screen edges, and everything works, except for this little 'feature'...


THanks in advance,



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

Mobile OS and Version: Android 5 -

Mobile Device Manufacturer and Model name: asus google nexus 7 -

Do the Vuforia Sample Applications show the same behavior?: cannot verify this exact same setup

Camera off center !

May 20, 2015 - 10:35pm #3


thank you very much for taking the time to write this extensive answer. I'll try it out and post back.

thanks again!


Camera off center !

May 11, 2015 - 1:32am #2

On some devices the camera projection matrix coming from the device profile is not centered.
To find a position in the center of the view frustum, you can shoot a ray from the center of the camera rect against a plane at the depth you need;
you can then use the resulting point to place the cube.


// Define a plane at the chosen distance

Plane depthPlane = new Plane(mCamera.transform.forward, mCamera.transform.position + mCamera.transform.forward * depth);


// we need to correct for a non-centered principal point - therefore we cast a ray from the center point defined by the camera projection

Ray principalPointRay = mCamera.ScreenPointToRay(new Vector3(mCamera.pixelRect.xMin + ((mCamera.pixelRect.xMax - mCamera.pixelRect.xMin) / 2f),

                                                             mCamera.pixelRect.yMin + ((mCamera.pixelRect.yMax - mCamera.pixelRect.yMin) / 2f), 0));



// and find the point at which the ray intersects the plane in local camera coordinates

float rayDist = 0.0f;

depthPlane.Raycast(principalPointRay, out rayDist);

Vector3 pointOnPlane = mCamera.transform.InverseTransformPoint(principalPointRay.GetPoint(rayDist));


Log in or register to post comments