一、安裝Vive
二、基地台位置
settings->developer->room overview
三、試玩遊戲
尋找期末作品靈感
四、程式碼練習
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class hw1code : MonoBehaviour {
//目標:找到手把
public SteamVR_TrackedObject leftController;
public GameObject cube; //目標:要把紅色的cube拿來改位置
//目標:找到按鈕trigger,按下去時印東西
// 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);
//把剛剛拉進來的public的cube,改他的位置
}
}

沒有留言:
張貼留言