daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Jan 21st, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using UnityEngine;
  2.  
  3. namespace Bhaptics.Tact.Unity
  4. {
  5.     public class TactReceiver : MonoBehaviour
  6.     {
  7.         public PositionTag PositionTag = PositionTag.Body;
  8.         public bool IsActive = true;
  9.  
  10.         void OnTriggerEnter(Collider bullet)
  11.         {
  12.             if (IsActive)
  13.             {
  14.                 Handle(bullet.transform.position, bullet.GetComponent<TactSender>());
  15.             }
  16.            
  17.         }
  18.  
  19.         void OnCollisionEnter(Collision bullet)
  20.         {
  21.             if (IsActive)
  22.             {
  23.                 Handle(bullet.contacts[0].point, bullet.gameObject.GetComponent<TactSender>());
  24.             }
  25.         }
  26.  
  27.         private void Handle(Vector3 contactPoint, TactSender tactSender)
  28.         {
  29.             if (tactSender != null)
  30.             {
  31.                 ////////////////////// please change this part
  32.                 var targetCollider = // get collider from the body not from hand // GetComponent<Collider>();
  33.                 tactSender.Play(PositionTag, contactPoint, targetCollider);
  34.             }
  35.         }
  36.     }
  37. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top