public static void Register(Collider col, NVRAttachPoint point) { if (!Colliders.ContainsKey(col)) { Colliders.Add(col, point); } }
protected virtual void Attach(NVRAttachPoint point) { point.Attached(this); AttachedItem = point.Item; AttachedPoint = point; }
public static void Register(Collider col, NVRAttachPoint point) { Debug.Assert(false == Colliders.ContainsKey(col)); if (false == Colliders.ContainsKey(col)) { Colliders.Add(col, point); } }
protected virtual void Detach() { if (AttachedPoint) { AttachedPoint.Detached(this); } AttachedItem = null; AttachedPoint = null; IsTryingToAttach = false; TryingToAttachItem = null; }
protected virtual void Detach() { OnDetach(AttachedPoint); AttachedPoint.Detached(this); if (SetKinematicWhenAttached) { AttachedItem.Rigidbody.isKinematic = _itemKinematicStatePreAttach; } // AttachedItem.EndInteraction(); AttachedItem = null; AttachedPoint = null; }
protected virtual void Attach(NVRAttachPoint point) { OnAttach(point); point.Attached(this); AttachedItem = point.Item; AttachedPoint = point; if (SnapToAttachPoint) { AttachedItem.transform.position = transform.position + (AttachedItem.transform.position - AttachedPoint.transform.position); } _itemKinematicStatePreAttach = AttachedItem.Rigidbody.isKinematic; if (SetKinematicWhenAttached) { AttachedItem.Rigidbody.isKinematic = true; } }
protected virtual void OnTriggerStay(Collider col) { if (IsAttached == false) { NVRAttachPoint point = AttachPointMapper.GetAttachPoint(col); if (point != null && point.IsAttached == false) { float distance = Vector3.Distance(point.transform.position, transform.position); if (distance < AttachRange) { Attach(point); } else { point.PullTowards(this); } } } }
protected virtual void OnTriggerStay(Collider col) { if (IsAttached == false && CanAttach == true) { NVRAttachPoint point = AttachPointMapper.GetAttachPoint(col); if (point != null && point.IsAttached == false) { float distance = Vector3.Distance(point.transform.position, this.transform.position); if (distance < AttachRange) { Attach(point); } else { point.PullTowards(this); } IsTryingToAttach = true; TryingToAttachItem = col.gameObject.GetComponentInParent <NVRInteractableItem> (); } } }
protected virtual void Detach() { AttachedPoint.Detached(this); AttachedItem = null; AttachedPoint = null; }
public static void Register(Collider col, NVRAttachPoint point) { Colliders.Add(col, point); }