How do I make the camera to be focused since it is always out of focus whenever I use ARCore with vuforia library?
The ARCamera control is taken over by ARCore and we have to manually set the camera to be on autofocus mode. Adding this script to camera object worked to be continous autofocus mode. Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class CameraFocusController : MonoBehaviour
{
void Start()
{
var vuforia = VuforiaARController.Instance;
vuforia.RegisterVuforiaStartedCallback(OnVuforiaStarted);
vuforia.RegisterOnPauseCallback(OnPaused);
}
private void OnVuforiaStarted()
{
CameraDevice.Instance.SetFocusMode(
CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
}
private void OnPaused(bool paused)
{
if (!paused) // resumed
{
// Set again autofocus mode when app is resumed
CameraDevice.Instance.SetFocusMode(
CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
}
}
}