/// <summary> /// Performs the raycast with a given radius. ColliderInfo is used to get the positions /// </summary> /// <param name="c">The colliderInfo to cast</param> /// <param name="castVec">The direction and magnitude of the cast</param> /// <param name="radius">The radius of the capsual</param> /// <param name="offset">The positional offset of the raycast</param> /// <returns>Returns the collision information for the hit objects</returns> private static RaycastHit[] CastAllGivenRadius(ColliderInfo c, Vector3 castVec, float radius, Vector3 offset) { //Perform the raycast RaycastHit[] h = Physics.CapsuleCastAll(c.GetUpperPoint() + offset, c.GetLowerPoint() + offset, radius, castVec.normalized, castVec.magnitude); //Sort the hit info by length so that the closest is first System.Array.Sort(h, Conditions.CompareDist); return(h); }
/// <summary> /// Draw debugging information /// </summary> private void OnDrawGizmosSelected() { colInfo.SetTransform(transform); Gizmos.color = Color.green; Gizmos.DrawLine(transform.position, transform.position + test); Gizmos.DrawWireSphere(colInfo.GetUpperPoint() + test, colInfo.Radius); Gizmos.DrawWireSphere(colInfo.GetLowerPoint() + test, colInfo.Radius); }