Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using UnityEngine;
- namespace Bhaptics.Tact.Unity
- {
- public class TactReceiver : MonoBehaviour
- {
- public PositionTag PositionTag = PositionTag.Body;
- public bool IsActive = true;
- void OnTriggerEnter(Collider bullet)
- {
- if (IsActive)
- {
- Handle(bullet.transform.position, bullet.GetComponent<TactSender>());
- }
- }
- void OnCollisionEnter(Collision bullet)
- {
- if (IsActive)
- {
- Handle(bullet.contacts[0].point, bullet.gameObject.GetComponent<TactSender>());
- }
- }
- private void Handle(Vector3 contactPoint, TactSender tactSender)
- {
- if (tactSender != null)
- {
- ////////////////////// please change this part
- var targetCollider = // get collider from the body not from hand // GetComponent<Collider>();
- tactSender.Play(PositionTag, contactPoint, targetCollider);
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment