Unity技术VR/AR分享Unity教程合集

Vuforia学习之自动对焦

2016-07-13  本文已影响724人  HoyaWhite
  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);  
        }  
    }  
}  
自动对焦脚本

脚本参考链接

上一篇下一篇

猜你喜欢

热点阅读