Camera position and angle different when running inside Unity and when running on Android

| | August 6, 2015

On Windows, running Unity 4.6.1p5, my simple game with only a cube, camera and light looks like this

windows view

but under Android (Gingerbread on a 5 inch Galaxy Player) the cube appears lower down, slightly different angle and smaller (relative to the screen size). Sorry couldn’t get a screenshot with my screenshot app…

Any ideas why please?

2 Responses to “Camera position and angle different when running inside Unity and when running on Android”

  1. Somehow the 2 views were because Unity wasn’t updating the Windows build, so it seems to have remained at a different camera position.

  2. Philip Allgaier on November 30, -0001 @ 12:00 AM

    The reason for this is most likely the different field of view (FOV in general or specific for Unity) in combination with the aspect ratio of the Android device.

    This thread covers the same problem: http://answers.unity3d.com/questions/23291/same-visible-area-regardless-of-aspect-ratio.html#

    The idea is to calculate the target FOV like this and apply it to the camera:

    float normalAspect = 16/9f;
    
    myCam.fieldOfView = myDesiredHorizontalFov * normalAspect / ((float)myCam.pixelWidth / myCam.pixelHeight); 
    

Leave a Reply