IMHOTEP Framework
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
BalloonHapticBump.cs
1 //======= Copyright (c) Valve Corporation, All rights reserved. ===============
2 //
3 // Purpose: Provides a haptic bump when colliding with balloons
4 //
5 //=============================================================================
6 
7 using UnityEngine;
8 using System.Collections;
9 
10 namespace Valve.VR.InteractionSystem
11 {
12  //-------------------------------------------------------------------------
13  public class BalloonHapticBump : MonoBehaviour
14  {
15  public GameObject physParent;
16 
17  //-------------------------------------------------
18  void OnCollisionEnter( Collision other )
19  {
20  Balloon contactBalloon = other.collider.GetComponentInParent<Balloon>();
21  if ( contactBalloon != null )
22  {
23  Hand hand = physParent.GetComponentInParent<Hand>();
24  if ( hand != null )
25  {
26  hand.controller.TriggerHapticPulse( 500 );
27  }
28  }
29  }
30  }
31 }