2019年3月5日 星期二

Week03_沈哲民

VR cardboard DIY




QR code 掃描 (google cardboard 1.0)


-------

Steam VR 更新

臉書社團中有
Steam VR 2.2基本操作說明


VR 手把震動設定
將左手把套用程式碼

using System.Collections; using System.Collections.Generic; using UnityEngine; using Valve.VR; public class vive : MonoBehaviour { public SteamVR_Action_Boolean triggerDown; public SteamVR_Action_Vibration hapticAction; public SteamVR_Action_Single squeezeAction; public SteamVR_Action_Vector2 touchpadTouch; // 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)) { hapticAction.Execute(0, 1, 150, 75, SteamVR_Input_Sources.LeftHand); print ("triggerDown"); (震動程式碼) } float triggerValue = squeezeAction.GetAxis(SteamVR_Input_Sources.Any); Vector2 padPos = touchpadTouch.GetAxis(SteamVR_Input_Sources.Any); if(triggerValue > 0.0f) { print(triggerValue); } if(padPos!= Vector2.zero) { print(padPos); } } }

Boolean類型在Unity中對應類爲SteamVR_Action_Boolean。Single類型在Unity中對應類爲SteamVR_Action_Single。Vector2類型在Unity中對應類爲SteamVR_Action_Vector2。Vector3類型在Unity中對應類爲SteamVR_Action_Vector3。Pose類型的動作表示三維空間中的位置和旋轉在Unity中對應類爲SteamVR_Action_Pose。
MyAction.Execute(float secondsFromNow(幾秒後開始), float durationSeconds(持續幾秒), float frequency(頻率), float amplitude(震幅), SteamVR_Input_Sources inputSource)





左手會震動囉!

沒有留言:

張貼留言