Search Unity

  1. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

OVRHapticsClip crashes/freezes Unity...!?

Discussion in 'AR/VR (XR) Discussion' started by MoPhat, Sep 24, 2019.

  1. MoPhat

    MoPhat

    Joined:
    Apr 3, 2014
    Posts:
    9
    Hi together

    I'm trying to vibrate the rift s Controller with a sound clip and Unity Always crashes/freezes… :mad:

    I have tryed this two solutions without success:

    Code (CSharp):
    1. public AudioClip sfxHit;
    2. OVRHaptics.Channels[0].Mix(new OVRHapticsClip(sfxHit));
    and

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5.  
    6. public class Saber : MonoBehaviour
    7. {
    8.     public LayerMask layer;
    9.     public AudioClip sfxHit;
    10.     public ParticleSystem Explosion;
    11.  
    12.     private AudioSource source;
    13.  
    14.     private OVRHapticsClip hapticsClip;
    15.  
    16.     void Start()
    17.     {
    18.         source = GetComponent<AudioSource>();
    19.         hapticsClip = new OVRHapticsClip(sfxHit);
    20.     }
    21.  
    22.     void Update()
    23.     {
    24.         RaycastHit hit;
    25.         if (Physics.Raycast(transform.position, transform.forward, out hit, 1, layer))
    26.         {
    27.             OVRHaptics.RightChannel.Mix(hapticsClip);
    28.  
    29.             Explosion.transform.position = gameObject.transform.position;
    30.             Explosion.Play();
    31.             Destroy(hit.transform.gameObject);
    32.  
    33.         }
    34.     }
    35. }
    Anyone a idea what i'm making wrong?
     
  2. bcjordan

    bcjordan

    Joined:
    Sep 23, 2013
    Posts:
    34
    I'm getting this too with a similar call chain. Unity 2020.3.25f1, using Oculus Link to run directly from editor.