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!
I always do it in Update.
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.
Thanks, I ended up going that
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.