BalloonHapticBump.cs 850 B

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