5

I am developing a sniper game for android using Google card board unity SDK. Now there is the need to tweak the camera's FOV which leads me to interact a variable named 'mockFieldOfView' in CardBoard.cs. Tweaking that value in the Unity editor is fine but as soon as I make a build for Android it doesn't take effect at all. I'm unable to figure out the issue. Any idea or suggestion would be highly appreciated.

Apologize for the late reply, so ouflak you can see complete Cardboard.cs here Cardboard.cs

user3839742
  • 51
  • 1
  • 3

2 Answers2

5

You don't want to change "mockFieldOfView". That only affects the in-editor FOV. The value you want to change is "matchMonoFOV" on the StereoController. You also have to set a "CenterOfInterest" game object on the StereoController. It makes the stereo FOV attempt to match the FOV on the Main Camera (or whichever camera has the StereoController script).

See StereoController.cs

Update: v0.4.5 of Cardboard SDK supports your use case. Use "matchByZoom" and set the FOV you want on the StereoController's camera. No center of interest is needed.

Mahendra Gunawardena
  • 1,956
  • 5
  • 26
  • 45
smd
  • 829
  • 2
  • 6
  • 7
  • Hi smd, I tried changing "matchMonoFOV" and seems it's quite similar to changing FOV, that's good, But I found really weird behavior when I rotate my head. What is happening now is changing in "matchMonoFOV" translates the camera which is child of Player. When player rotates it's head the camera turns to spectator and goes off and through the terrain because of its translation. How would I fix it(How to avoid translation of the camera instead we need rotation)? – user3839742 Jan 23 '15 at 12:17
  • What is the FOV of the mono camera? Where do you have the CenterOfInterest game object? – smd Jan 24 '15 at 07:59
  • Ah, since you mentioned that it is a sniper game, I'm guessing the trouble is when looking through the scope? I think the matchMonoFOV method is not the way to go for that case. Viewing through a scope is not a VR situation. – smd Jan 25 '15 at 03:40
  • Can you try an experiment? Edit CardboardEye.cs and comment out these two lines: "camera.projectionMatrix = proj;" and "camera.fieldOfView = [complicated math];" This will leave each stereo eye FOV the same as the parent camera. When you set the parent camera to a "viewing through the scope" FOV, does it work any better? – smd Jan 25 '15 at 03:54
1

I had the same issue and in my case it helped to put the MainCamera closer to the object which was the Cockpit of a car in my case.

In order to put the MainCamera closer than 1 real-world-meter to the object you must change the default-minimum-value in Cardboard.cs - I use the following setting:

private readonly Vector2 defaultComfortableViewingRange = new Vector2(0.0f, 100000.0f);
walt
  • 101
  • 5
  • 1
    You can disable the comfort range checking by clearing the StereoController's "Check Stereo Comfort" box. That will bypass checking the viewing range vector altogether. – smd Aug 30 '15 at 22:14