bool IsGrounded(CharacterControl control)
        {
            if (control.RIGID_BODY.velocity.y > -0.001f && control.RIGID_BODY.velocity.y <= 0f)
            {
                return(true);
            }

            if (control.RIGID_BODY.velocity.y < 0f)
            {
                foreach (GameObject o in control.colS.BottomSpheres)
                {
                    Debug.DrawRay(o.transform.position, -Vector3.up * 0.7f, Color.yellow);
                    RaycastHit hit;
                    if (Physics.Raycast(o.transform.position, -Vector3.up, out hit, Distance))
                    {
                        if (!control.RagdollParts.Contains(hit.collider) &&
                            !Ledge.IsLedge(hit.collider.gameObject) &&
                            !Ledge.IsLedgeChecker(hit.collider.gameObject))
                        {
                            return(true);
                        }
                    }
                }
            }

            return(false);
        }
Beispiel #2
0
 private void OnTriggerExit(Collider other)
 {
     CheckLedge = other.gameObject.GetComponent <Ledge>();
     if (CheckLedge != null)
     {
         IsGrabbingLedge = false;
     }
 }
Beispiel #3
0
 private void OnTriggerEnter(Collider other)
 {
     CheckLedge = other.gameObject.GetComponent <Ledge>();
     if (CheckLedge != null)
     {
         IsGrabbingLedge = true;
         GrabbedLedge    = CheckLedge;
     }
 }