2014-10-11 25 views
0

我已經下載了sdk並試圖加載演示場景,但是當我導出apk時,沒有頭部追蹤,有什麼建議?演示場景中沒有頭部追蹤

上安裝APK,我得到的立體場景和立方體旋轉,但沒有頭部跟蹤。我可以打開和關閉失真,但沒有找到我可以啓用頭部追蹤的位置。

任何幫助將不勝感激。

回答

-1

同樣在這裏:我看到了演示現場的左/右分割畫面(在網格的背景和三個光源旋轉的立方體),但是沒有頭部跟蹤。沒有預失真。 這是一款採用Unity 4.5.3f3的三星Galaxy S3(Android 4.3)。

+0

使用'向Question'按鈕 – chouaib 2014-10-11 13:29:27

1

1)與此內容創建Unity3D一個新的C#腳本:

using UnityEngine; 
using System.Collections; 

public class VROneRotateAround : MonoBehaviour { 
    public Transform target; 
    public float distance = 5f; 
    public Vector3 offset = Vector3.zero; 
    public bool useAngleX = true; 
    public bool useAngleY = true; 
    public bool useAngleZ = true; 
    public bool useRealHorizontalAngle = true; 
    public bool resetViewOnTouch = true; 

    private Quaternion initialRotation = Quaternion.identity; 
    private Quaternion currentRotation; 
    private static Vector3 gyroAngles; // original angles from gyro 
    private static Vector3 usedAngles; // converted into unity world coordinates 

    private int userSleepTimeOut; // original device SleepTimeOut setting 
    private bool gyroAvail = false; 

    void Start() { 
     Input.compensateSensors = true; 
     transform.position = (target.position + offset) - transform.forward * distance; 
    } 
    void FixedUpdate() { 
     if (gyroAvail == false) { 
      if (Input.gyro.attitude.eulerAngles != Vector3.zero && Time.frameCount > 30) { 
       gyroAvail = true; 
       initialRotation = Input.gyro.attitude; 
       target.gameObject.SendMessage("StartFlight"); 
      } 
      return; // early out 
     } 

     // reset origin on touch or not yet set origin 
     if(resetViewOnTouch && (Input.touchCount > 0)) 
      initialRotation = Input.gyro.attitude; 

     // new rotation 
     currentRotation = Quaternion.Inverse(initialRotation)*Input.gyro.attitude; 

     gyroAngles = currentRotation.eulerAngles; 

     //usedAngles = Quaternion.Inverse (currentRotation).eulerAngles; 
     usedAngles = gyroAngles; 

     // reset single angle values 
     if (useAngleX == false) 
      usedAngles.x = 0f; 
     if (useAngleY == false) 
      usedAngles.y = 0f; 
     if (useAngleZ == false) 
      usedAngles.z = 0f; 

     if (useRealHorizontalAngle) 
      usedAngles.y *= -1; 
     transform.localRotation = Quaternion.Euler (new Vector3(-usedAngles.x, usedAngles.y, usedAngles.z)); 
     transform.position = (target.position + offset) - transform.forward * distance; 
    } 

    public static Vector3 GetUsedAngles() { 
     return usedAngles; 
    } 

    public static Vector3 GetGyroAngles() { 
     return gyroAngles; 
    } 

    public void ResetView() { 
     initialRotation = Input.gyro.attitude; 
    } 

    void OnEnable() { 
     // sensor on 
     Input.gyro.enabled = true; 
     initialRotation = Quaternion.identity; 
     gyroAvail = false; 

     // store device sleep timeout setting 
     userSleepTimeOut = Screen.sleepTimeout; 
     // disable sleep timeout when app is running 
     Screen.sleepTimeout = SleepTimeout.NeverSleep; 
    } 

    void OnDisable() { 
     // restore original sleep timeout 
     Screen.sleepTimeout = userSleepTimeOut; 
     //sensor off 
     Input.gyro.enabled = false; 
    } 
} 

打開演示現場,並附上該腳本在VROneSDK預製。

在屬性編輯器中選擇多維數據集作爲目標和距離進入6。

構建應用程序和測試設備上或使用UnityRemote測試編輯器中的行爲。

+0

謝謝,我已經完全的上述步驟完成一個,我不是太清楚如何執行以下操作:「在屬性編輯器中選擇多維數據集作爲目標和距離進入6」。可以告訴我如何選擇立方體作爲目標?這是在您發佈的腳本中完成的嗎? – euvrco 2014-10-11 21:23:19

+0

上述腳本中的第一個公共參數被命名爲target。然後將腳本附加到VROneSDK預製件,將任何對象從統一場景拖放到屬性編輯器中的此字段。目標將是相機旋轉的gameobject。 – Harry 2014-10-14 05:56:31

+0

就像一個魅力 – 2015-01-24 13:31:51

0

的SDK似乎只在支持的deviced你需要得到一個S5得到它的工作運行。您還需要獲取適用於Unity的Android Pro插件。 我們實際上確實得到了這種情緒,但屏幕在任何一邊都會像10像素一樣被裁剪掉。這是不對的。