Log in or register to post comments

ARCamera FOV Set after Vuforia Started

March 8, 2019 - 10:54am #1

I have a second camera in my scene that I want to match the main camera FOV. 

Vuforia sets the AR Camera FOV at runtime, so I need to update the second camera to match it once Vuforia changes it. The following code does not work:

void Start()

    {

        mainCamera = Camera.main;

        var vuforia = VuforiaARController.Instance;

        vuforia.RegisterVuforiaStartedCallback( OnVuforiaStarted );

    }

    private void OnVuforiaStarted()

    {

        if ( mainCamera != null )

        {

            GetComponentInChildren<Camera>().fieldOfView = mainCamera.fieldOfView;

        }

    }

(Code formatting not working)

If I wait a few additional frames, the mainCamera.fieldOfView does change to match my hardware. Is there any sort of callback/event I can listen to that gets fired when the FOV changes? 

Thanks!

ARCamera FOV Set after Vuforia Started

March 8, 2019 - 6:37pm #3

Thanks, I ended up going that route too. I didn't think about it, but since I support auto-rotation, I need to update the FOV every time the device is rotated. Probably more trouble than its worth to hook into all of those events, so update will suffice for now. 

ARCamera FOV Set after Vuforia Started

March 8, 2019 - 1:36pm #2

I always do it in Update.  Maybe not ideal, but I don't think you'll see any performance impact since you're just setting a variable.

Log in or register to post comments