protected static void SetupInstance()
 {
     if (instance == null && VRTK_SDKManager.ValidInstance())
     {
         instance = VRTK_SDKManager.instance.gameObject.AddComponent <VRTK_ControllerHaptics>();
     }
 }
Beispiel #2
0
 protected virtual void AttemptHapticPulse(float strength)
 {
     if (events)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(VRTK_ControllerReference.GetControllerReference(events.gameObject), strength);
     }
 }
Beispiel #3
0
 // Token: 0x06001149 RID: 4425 RVA: 0x0006550F File Offset: 0x0006370F
 protected override void AttemptHapticPulse(float strength)
 {
     if (this.interactingObjects.Count > 0)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(VRTK_ControllerReference.GetControllerReference(this.interactingObjects[0]), strength);
     }
 }
Beispiel #4
0
 // Token: 0x0600152D RID: 5421 RVA: 0x00074CF5 File Offset: 0x00072EF5
 public static void CancelHapticPulse(VRTK_ControllerReference controllerReference)
 {
     VRTK_ControllerHaptics.SetupInstance();
     if (VRTK_ControllerHaptics.instance != null)
     {
         VRTK_ControllerHaptics.instance.InternalCancelHapticPulse(controllerReference);
     }
 }
Beispiel #5
0
 // Token: 0x0600152B RID: 5419 RVA: 0x00074CB3 File Offset: 0x00072EB3
 public static void TriggerHapticPulse(VRTK_ControllerReference controllerReference, float strength, float duration, float pulseInterval)
 {
     VRTK_ControllerHaptics.SetupInstance();
     if (VRTK_ControllerHaptics.instance != null)
     {
         VRTK_ControllerHaptics.instance.InternalTriggerHapticPulse(controllerReference, strength, duration, pulseInterval);
     }
 }
Beispiel #6
0
 // Token: 0x0600152C RID: 5420 RVA: 0x00074CD5 File Offset: 0x00072ED5
 public static void TriggerHapticPulse(VRTK_ControllerReference controllerReference, AudioClip clip)
 {
     VRTK_ControllerHaptics.SetupInstance();
     if (VRTK_ControllerHaptics.instance != null)
     {
         VRTK_ControllerHaptics.instance.InternalTriggerHapticPulse(controllerReference, clip);
     }
 }
Beispiel #7
0
        public void GunFire()
        {
            Rigidbody  gunRig;
            GameObject shootBullet = Instantiate(BulletPrefab, Emitter.transform.position, Emitter.transform.rotation);

            gunRig = shootBullet.GetComponent <Rigidbody> ();
            VRTK_ControllerHaptics.TriggerHapticPulse(VRTK_ControllerReference.GetControllerReference(usingObject.gameObject), 1.0f);
            gunRig.AddForce(transform.forward * speed);
            Destroy(shootBullet, 10.0f);
        }
Beispiel #8
0
 /// <summary>
 /// The HapticsOnGrab method triggers the haptic feedback on the given controller for the settings associated with grab.
 /// </summary>
 /// <param name="controllerReference">The reference to the controller to activate the haptic feedback on.</param>
 public virtual void HapticsOnGrab(VRTK_ControllerReference controllerReference)
 {
     if (clipOnGrab != null)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, clipOnGrab);
     }
     else if (strengthOnGrab > 0 && durationOnGrab > 0f)
     {
         TriggerHapticPulse(controllerReference, strengthOnGrab, durationOnGrab, intervalOnGrab);
     }
 }
Beispiel #9
0
 // Token: 0x060015C2 RID: 5570 RVA: 0x0007738C File Offset: 0x0007558C
 public virtual void HapticsOnGrab(VRTK_ControllerReference controllerReference)
 {
     if (this.clipOnGrab != null)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, this.clipOnGrab);
     }
     else if (this.strengthOnGrab > 0f && this.durationOnGrab > 0f)
     {
         this.TriggerHapticPulse(controllerReference, this.strengthOnGrab, this.durationOnGrab, this.intervalOnGrab);
     }
     this.OnInteractHapticsGrabbed(this.SetEventPayload(controllerReference));
 }
Beispiel #10
0
 /// <summary>
 /// The HapticsOnUse method triggers the haptic feedback on the given controller for the settings associated with use.
 /// </summary>
 /// <param name="controllerReference">The reference to the controller to activate the haptic feedback on.</param>
 public virtual void HapticsOnUse(VRTK_ControllerReference controllerReference)
 {
     if (clipOnUse != null)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, clipOnUse);
     }
     else if (strengthOnUse > 0 && durationOnUse > 0f)
     {
         TriggerHapticPulse(controllerReference, strengthOnUse, durationOnUse, intervalOnUse);
     }
     OnInteractHapticsUsed(SetEventPayload(controllerReference));
 }
 /// <summary>
 /// The HapticsOnGrab method triggers the haptic feedback on the given controller for the settings associated with grab.
 /// </summary>
 /// <param name="controllerReference">The reference to the controller to activate the haptic feedback on.</param>
 public virtual void HapticsOnGrab(VRTK_ControllerReference controllerReference)
 {
     if (clipOnGrab != null)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, clipOnGrab);
     }
     else if (strengthOnGrab > 0 && durationOnGrab > 0f)
     {
         TriggerHapticPulse(controllerReference, strengthOnGrab, durationOnGrab, intervalOnGrab);
     }
     else
     {
         VRTK_ControllerHaptics.CancelHapticPulse(controllerReference);
     }
     OnInteractHapticsGrabbed(SetEventPayload(controllerReference));
 }
 /// <summary>
 /// The HapticsOnNearTouch method triggers the haptic feedback on the given controller for the settings associated with near touch.
 /// </summary>
 /// <param name="controllerReference">The reference to the controller to activate the haptic feedback on.</param>
 public virtual void HapticsOnNearTouch(VRTK_ControllerReference controllerReference)
 {
     if (clipOnNearTouch != null)
     {
         VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, clipOnNearTouch);
     }
     else if (strengthOnNearTouch > 0 && durationOnNearTouch > 0f)
     {
         TriggerHapticPulse(controllerReference, strengthOnNearTouch, durationOnNearTouch, intervalOnNearTouch);
     }
     else
     {
         VRTK_ControllerHaptics.CancelHapticPulse(controllerReference);
     }
     OnInteractHapticsNearTouched(SetEventPayload(controllerReference));
 }
Beispiel #13
0
 protected virtual void TriggerHapticPulse(VRTK_ControllerReference controllerReference, float strength, float duration, float interval)
 {
     VRTK_ControllerHaptics.TriggerHapticPulse(controllerReference, strength, duration, (interval >= minInterval ? interval : minInterval));
 }
Beispiel #14
0
 public static void CancelHapticPulse(uint controllerIndex)
 {
     VRTK_ControllerHaptics.CancelHapticPulse(VRTK_ControllerReference.GetControllerReference(controllerIndex));
 }
Beispiel #15
0
 public static void TriggerHapticPulse(uint controllerIndex, float strength, float duration, float pulseInterval)
 {
     VRTK_ControllerHaptics.TriggerHapticPulse(VRTK_ControllerReference.GetControllerReference(controllerIndex), strength, duration, pulseInterval);
 }
Beispiel #16
0
 public static void TriggerHapticPulse(uint controllerIndex, float strength)
 {
     VRTK_ControllerHaptics.TriggerHapticPulse(VRTK_ControllerReference.GetControllerReference(controllerIndex), strength);
 }
 /// <summary>
 /// The CancelHaptics method cancels any existing haptic feedback on the given controller.
 /// </summary>
 /// <param name="controllerReference"></param>
 public virtual void CancelHaptics(VRTK_ControllerReference controllerReference)
 {
     VRTK_ControllerHaptics.CancelHapticPulse(controllerReference);
 }