01-21-2017 11:50 PM
01-21-2017 11:51 PM
05-30-2019 06:54 AM
OVRInput.SetControllerVibration(0, 0, OVRInput.Controller.RTouch);
IEnumerator Haptics(float frequency, float amplitude, float duration, bool rightHand, bool leftHand)
{
if(rightHand) OVRInput.SetControllerVibration(frequency, amplitude, OVRInput.Controller.RTouch);
if(leftHand) OVRInput.SetControllerVibration(frequency, amplitude, OVRInput.Controller.LTouch);
yield return new WaitForSeconds(duration);
if (rightHand) OVRInput.SetControllerVibration(0, 0, OVRInput.Controller.RTouch);
if (leftHand) OVRInput.SetControllerVibration(0, 0, OVRInput.Controller.LTouch);
}
I put that into a new script called HapticsController and then created functions to suit, I.E this is my functions for when I shoot a gunpublic void PlayShoot(bool rightHanded)
{
if(rightHanded) StartCoroutine(Haptics(1, 1, 0.3f, true, false));
else StartCoroutine(Haptics(1, 1, 0.3f, false, true));
}
06-11-2019 01:30 AM
06-11-2019 09:45 AM
public class TestHaptics : MonoBehaviour
{
private OVRHapticsClip hapticsClip;
public AudioClip testClip;
void Start()
{
hapticsClip = new OVRHapticsClip(testClip);
}
private void OnTriggerEnter(Collider other)
{
OVRHaptics.RightChannel.Mix(hapticsClip);
OVRHaptics.LeftChannel.Mix(hapticsClip);
}
}
10-14-2021 08:35 AM - edited 10-14-2021 08:37 AM
This worked for me