目標一:讓VIVE定位基地台
紅、藍扇形為接收器之範圍,小型紫色矩形為頭盔與手把
測試軟體,如果測試成功應有與畫面上相同的圖像
就緒介面:若連接成功會有以下綠色的UI
分別為:頭盔、手把X2、基地台X2
目標二:測試手把產生紅色方塊
程式碼:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class hw1 : MonoBehaviour {
public SteamVR_TrackedObject leftController;
public GameObject cube;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
if (leftController == null || leftController.index == SteamVR_TrackedObject.EIndex.None)
return;
var device = SteamVR_Controller.Input ((int)leftController.index);
if (device.GetPressDown (SteamVR_Controller.ButtonMask.Trigger)) {
print ("Press Trigger");
}
cube.transform.SetPositionAndRotation (leftController.transform.position, leftController.transform.rotation);
}
結果:




沒有留言:
張貼留言