- 新建C#脚本
- 把脚本拖给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);
}
}
}
自动对焦脚本
脚本参考链接
网友评论