承接ARVR外包项目 史小川QQ: 2118590660
ARVR行业交流QQ群:750656715
公众号: ARVR行业领跑者
B站: ARVRinChina
先写一个控制类的脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Valve.VR;
public class ShockController : MonoBehaviour
{
public SteamVR_Action_Vibration hapticAction;
public SteamVR_Action_Boolean trackpadAction;
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
if (trackpadAction.GetLastStateDown(SteamVR_Input_Sources.RightHand))
{
Pulse(1, 150, 75, SteamVR_Input_Sources.RightHand);
}
if (trackpadAction.GetLastStateDown(SteamVR_Input_Sources.LeftHand))
{
Pulse(1, 150, 75, SteamVR_Input_Sources.LeftHand);
}
}
private void Pulse(float duration, float frequency, float amplitude, SteamVR_Input_Sources source)
{
hapticAction.Execute(0, duration, frequency, amplitude, source);
print("Pluse");
}
}
2. 可以建个空物体
挂上你的控制脚本 Shock Controller,
再挂上插件脚本 SteamVR_Activate Action Set
在画线的地方 设置你得手柄输入(哪种情况下震动)