コード例 #1
0
        public static bool RayCastVoxels(ref Vector3D start, ref Vector3D end, out MyVoxelBase hitVoxel, out Vector3D hitPosition, bool checkPlanet = DefaultCheckPlanet)
        {
#if PROFILE
            Profiler.StartProfileBlock();
            try
            {
#endif
            CapsuleD capsule;
            capsule.P0     = start;
            capsule.P1     = end;
            capsule.Radius = 0f;

            return(CapsuleDExtensions.IntersectsVoxel(ref capsule, out hitVoxel, out hitPosition, checkPlanet));

#if PROFILE
        }

        finally { Profiler.EndProfileBlock(); }
#endif
        }
コード例 #2
0
        /// <summary>
        /// Ray cast all the voxels in the world to check for intersection.
        /// </summary>
        /// <param name="line">The line to check</param>
        ///// <param name="shortTest">Shortens the line by 5 m, needed to interact with an entity that may be on the surface of the voxel.</param>
        /// <returns>True iff any voxel intersects the line</returns>
        public static bool RayCastVoxels(LineD line, out MyVoxelBase hitVoxel, out Vector3D hitPosition, bool checkPlanet = DefaultCheckPlanet)
        {
            //const double ShortenBy = 5d;
#if PROFILE
            Profiler.StartProfileBlock();
            try
            {
#endif
            CapsuleD capsule;
            capsule.P0     = line.From;
            capsule.P1     = line.To;
            capsule.Radius = 0f;
            return(CapsuleDExtensions.IntersectsVoxel(ref capsule, out hitVoxel, out hitPosition, checkPlanet));

#if PROFILE
        }

        finally { Profiler.EndProfileBlock(); }
#endif
        }