OvrControllerHit.cs 785 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using System;
  2. using UnityEngine;
  3. public class OvrControllerHit : MonoBehaviour
  4. {
  5. private void Start()
  6. {
  7. byte[] array = new byte[32];
  8. for (int i = 0; i < array.Length; i++)
  9. {
  10. array[i] = 128;
  11. }
  12. NDebug.Assert(OVRPlugin.version >= new Version(1, 6, 0), "Unity内臓のOVRPlugin.dllが古いです。");
  13. this.m_HapticsClip = new OVRHapticsClip(array, array.Length);
  14. }
  15. private void OnCollisionEnter(Collision collision)
  16. {
  17. this.CoVive();
  18. }
  19. private void CoVive()
  20. {
  21. if (this.m_bHandL)
  22. {
  23. OVRHaptics.LeftChannel.Mix(this.m_HapticsClip);
  24. }
  25. else
  26. {
  27. OVRHaptics.RightChannel.Mix(this.m_HapticsClip);
  28. }
  29. }
  30. public ushort m_uViveForce = 1000;
  31. public float m_fViveTimeMS = 0.1f;
  32. public bool m_bHandL = true;
  33. private OVRHapticsClip m_HapticsClip;
  34. }