Example #1
0
        public static Vector3 RandomPoint(this Collider that)
        {
            MeshCollider meshCollider = that as MeshCollider;

            if (meshCollider != null)
            {
                return(meshCollider.RandomPoint());
            }
            BoxCollider boxCollider = that as BoxCollider;

            if (boxCollider != null)
            {
                return(boxCollider.RandomPoint());
            }
            CapsuleCollider capsuleCollider = that as CapsuleCollider;

            if (capsuleCollider != null)
            {
                return(capsuleCollider.RandomPoint());
            }
            SphereCollider sphereCollider = that as SphereCollider;

            if (sphereCollider != null)
            {
                return(sphereCollider.RandomPoint());
            }
            throw new NotImplementedException("UltimateWater: Unknown collider type.");
        }