public static int CastAll(IPhysicsGeom geom, Vector3 dir, ICollection <RaycastHit> results, float dist, int layerMask, QueryTriggerInteraction query = QueryTriggerInteraction.UseGlobal)
        {
            if (geom == null)
            {
                throw new System.ArgumentNullException("geom");
            }

            return(geom.CastAll(dir, results, dist, layerMask, query));
        }
        public static int CastAll(IPhysicsGeom geom, Vector3 dir, ICollection <RaycastHit> results, QueryTriggerInteraction query = QueryTriggerInteraction.UseGlobal)
        {
            if (geom == null)
            {
                throw new System.ArgumentNullException("geom");
            }

            return(geom.CastAll(dir, results, float.PositiveInfinity, Physics.AllLayers, query));
        }
        public static RaycastHit[] CastAll(IPhysicsGeom geom, Vector3 dir, float dist, int layerMask, QueryTriggerInteraction query = QueryTriggerInteraction.UseGlobal)
        {
            if (geom == null) throw new System.ArgumentNullException("geom");

            //return geom.CastAll(dir, dist, layerMask, query).ToArray();

            using (var lst = TempCollection.GetList<RaycastHit>())
            {
                geom.CastAll(dir, lst, dist, layerMask, query);
                return lst.ToArray();
            }
        }
        public static RaycastHit[] CastAll(IPhysicsGeom geom, Vector3 dir, QueryTriggerInteraction query = QueryTriggerInteraction.UseGlobal)
        {
            if (geom == null)
            {
                throw new System.ArgumentNullException("geom");
            }

            //return geom.CastAll(dir, float.PositiveInfinity, Physics.AllLayers, query).ToArray();

            using (var lst = TempCollection.GetList <RaycastHit>())
            {
                geom.CastAll(dir, lst, float.PositiveInfinity, Physics.AllLayers, query);
                return(lst.ToArray());
            }
        }
        public static bool RadialCast(IPhysicsGeom geom, ICollection<RaycastHit> results, float dist, int detail, int layerMask, Vector3 initialAxis, Vector3 rotationalAxis, QueryTriggerInteraction query = QueryTriggerInteraction.UseGlobal)
        {
            if (VectorUtil.NearZeroVector(initialAxis))
                initialAxis = Vector2.right;
            else
                initialAxis.Normalize();
            var a = 360f / (float)detail;

            int cnt = results.Count;
            for (int i = 0; i < detail; i++)
            {
                var v = VectorUtil.RotateAroundAxis(initialAxis, a * i, rotationalAxis);
                geom.CastAll(v, results, dist, layerMask, query);
            }
            return results.Count - cnt > 0;
        }
        public static RaycastHit[] CastAll(IPhysicsGeom geom, Vector3 dir, float dist, int layerMask)
        {
            if (geom == null) throw new System.ArgumentNullException("geom");

            return geom.CastAll(dir, dist, layerMask).ToArray();
        }
        public static RaycastHit[] CastAll(IPhysicsGeom geom, Vector3 dir)
        {
            if (geom == null) throw new System.ArgumentNullException("geom");

            return geom.CastAll(dir, float.PositiveInfinity, Physics.AllLayers).ToArray();
        }
        public static IEnumerable<RaycastHit> RadialCast(IPhysicsGeom geom, float dist, int detail, int layerMask, Vector2 initialAxis)
        {
            if (VectorUtil.NearZeroVector(initialAxis))
                initialAxis = Vector2.right;
            else
                initialAxis.Normalize();
            var a = 360f / (float)detail;

            for (int i = 0; i < detail; i++)
            {
                var v = VectorUtil.RotateBy(initialAxis, a * i);
                foreach (var h in geom.CastAll(v, dist, layerMask))
                {
                    yield return h;
                }
            }
        }