Vuforia学习之自动对焦

  1. 新建C#脚本
  2. 把脚本拖给ARCamera
using UnityEngine;  
using System.Collections;  
  
public class ARCameraAutomic : MonoBehaviour  
{  
    // Use this for initialization  
    void Start()  
    {  
        Vuforia.CameraDevice.Instance.SetFocusMode(Vuforia.CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);  
    }  
  
    // Update is called once per frame  
    void Update()  
    {  
        #if UNITY_EDITOR  
        if(Input.GetMouseButtonUp(0))  
            #elif UNITY_ANDROID || UNITY_IPHONE  
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)  
                #endif  
        {  
            Vuforia.CameraDevice.Instance.SetFocusMode(Vuforia.CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);  
        }  
    }  
}  
Vuforia学习之自动对焦_第1张图片
自动对焦脚本

脚本参考链接

你可能感兴趣的:(Vuforia学习之自动对焦)