Vuforia自动关注Android Unity

时间:2017-01-19 09:20:43

标签: android unity3d sdk augmented-reality vuforia

我正在使用Vuforia和Unity3d。相机在各种设备上运行良好但在HTC,Nexus 6p等手机上出现模糊/对焦问题。我在ARCamera上使用Autofocus脚本。

以下是代码: -

 using UnityEngine;
 using System.Collections;
 using Vuforia;
 public class CameraFocus : MonoBehaviour {

 bool FocusModeSet;

void Awake()
{
    //CameraDevice.Instance.SetFocusMode (CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO);
    FocusModeSet  = CameraDevice.Instance.SetFocusMode (  
        CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO); 

    if (FocusModeSet == false) 
    {  
        Debug.Log ("to set focus mode Failed (mode unsupported) ().");  
    } 
}
}

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

我有类似的问题。我创建了脚本,它将相机聚焦模式设置为特定的Vuforia状态。您可以查看下面的示例代码:

Myvariable = (select Column from table1 where column =1234 group by column);
select column from table2 where column in (myvariable);
select column from table3 where column in (myvariable);

我将此脚本固定到标准public class CameraController : MonoBehaviour { void Start() { VuforiaBehaviour.Instance.RegisterVuforiaStartedCallback(OnVuforiaStarted); VuforiaBehaviour.Instance.RegisterOnPauseCallback(OnVuforiaStarted); } private void OnVuforiaStarted() { CameraDevice.Instance.SetFocusMode( CameraDevice.FocusMode.FOCUS_MODE_CONTINUOUSAUTO); } 对象。