Guest User

Untitled

a guest
Jan 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  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. }
Add Comment
Please, Sign In to add comment