Example #1
0
 public static void Register(Collider col, NVRAttachPoint point)
 {
     if (!Colliders.ContainsKey(col))
     {
         Colliders.Add(col, point);
     }
 }
Example #2
0
        protected virtual void Attach(NVRAttachPoint point)
        {
            point.Attached(this);

            AttachedItem  = point.Item;
            AttachedPoint = point;
        }
Example #3
0
        protected virtual void Attach(NVRAttachPoint point)
        {
            point.Attached(this);

            AttachedItem = point.Item;
            AttachedPoint = point;
        }
Example #4
0
 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;
        }
Example #6
0
        protected virtual void Detach()
        {
            OnDetach(AttachedPoint);
            AttachedPoint.Detached(this);

            if (SetKinematicWhenAttached)
            {
                AttachedItem.Rigidbody.isKinematic = _itemKinematicStatePreAttach;
            }
            // AttachedItem.EndInteraction();

            AttachedItem  = null;
            AttachedPoint = null;
        }
Example #7
0
        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;
            }
        }
Example #8
0
        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> ();
                }
            }
        }
Example #10
0
 protected virtual void Detach()
 {
     AttachedPoint.Detached(this);
     AttachedItem  = null;
     AttachedPoint = null;
 }
 public static void Register(Collider col, NVRAttachPoint point)
 {
     Colliders.Add(col, point);
 }
Example #12
0
 public static void Register(Collider col, NVRAttachPoint point)
 {
     Colliders.Add(col, point);
 }
Example #13
0
 protected virtual void Detach()
 {
     AttachedPoint.Detached(this);
     AttachedItem = null;
     AttachedPoint = null;
 }