1. VR cardboard DIY
↑(圖1 VR cardboard 的實作步驟)
↑(圖2 VR cardboard 完成結果)
VRcardbroad需要掃描QR code 設定自己的Cardbroad,因為每個設備解析度和距離會不一樣。
↑(圖3 VR cardboard 的QR code)
2. HTC VIVE 的Unity 設定
↑(圖4 SteamVR的設定,檔案在FB社團-"2019虛擬實境"裡)
網址連結:點擊連結

用Unity寫HTC VIVE 手把震動

↑(圖5 手把震動程式碼)
--------------------------(以下是震動程式碼)--------------------------
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);
}
}
}
----------------------------------------------------------------------------
可以看到Print出手把值
↑(圖6 做完輸出的值)
沒有留言:
張貼留言