2019年3月26日 星期二

Week6_沈哲民

了解VR手把程式

using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; public class vive : MonoBehaviour { public SteamVR_Action_Boolean triggerDown;//宣告triggerDown public SteamVR_Action_Vibration hapticAction; public SteamVR_Action_Single squeezeAction; public SteamVR_Action_Vector2 touchpadTouch;
float x=0;
bool state=false;
public GameObject myPhere; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { if(triggerDown.GetState(SteamVR_Input_Sources.Any))//偵測手把的狀態 { if(state==false){

  state=true;
print("yes");
GameObject now=Instantiate(mySphere);產生object
now.transform.position = new Vector3(x,0,0);產生的位置
x++;
} }

沒有留言:

張貼留言