public void AddSphere(SphereDesc sphere, RigidbodyDesc rigidbodyDesc, int entityId)
 {
     _spheres.Add(new RigidbodyColliderDesc <SphereDesc>()
     {
         entityId  = entityId,
         collider  = sphere,
         rigidbody = rigidbodyDesc
     });
 }
        public static bool GetClosestSurfacePoint(float3 p, SphereDesc sphere, out ConcatInfo concatInfo)
        {
            concatInfo = default(ConcatInfo);
            float3 c2p = p - sphere.center;
            float  d2  = math.dot(c2p, c2p);
            float  r2  = sphere.radius * sphere.radius;

            if (d2 < r2)
            {
                concatInfo.normal   = math.normalize(c2p);
                concatInfo.position = sphere.center + concatInfo.normal * sphere.radius;
                return(true);
            }
            else
            {
                return(false);
            }
        }
        /// <summary>
        /// 检查点是否在球内
        /// </summary>
        public static bool PointInside(float3 p, SphereDesc sphere)
        {
            float3 d = sphere.center - p;

            return(math.dot(d, d) < sphere.radius * sphere.radius);
        }