public override bool GetIntersectionWithLine(ref MyLine line, out MyIntersectionResultLineTriangleEx?t, IntersectionFlags flags = IntersectionFlags.ALL_TRIANGLES)
        {
            t = null;
            foreach (MyPrefabBase prefab in m_prefabs)
            {
                MyEntity entity = prefab as MyEntity;
                MyIntersectionResultLineTriangleEx?prefabIntersectionResult;
                entity.GetIntersectionWithLine(ref line, out prefabIntersectionResult);
                t = MyIntersectionResultLineTriangleEx.GetCloserIntersection(ref t, ref prefabIntersectionResult);
            }

            return(t != null);
        }
示例#2
0
        public MyIntersectionResultLineTriangleEx?GetIntersectionWithLine(ref MyLine line)
        {
            MyIntersectionResultLineTriangleEx?result = null;

            //  Test against childs of this phys object (in this case guns)
            foreach (MyGunBase gun in m_guns)
            {
                MyIntersectionResultLineTriangleEx?intersectionGun = gun.GetIntersectionWithLine(ref line);

                result = MyIntersectionResultLineTriangleEx.GetCloserIntersection(ref result, ref intersectionGun);
            }

            return(result);
        }
        /// <summary>
        /// Returns interstection with line
        /// </summary>
        /// <param name="line">Line</param>
        /// <returns></returns>
        public MyIntersectionResultLineTriangleEx?GetIntersectionWithLine(ref MyLine line)
        {
            MyIntersectionResultLineTriangleEx?result = null;

            //  Test against childs of this phys object (in this case guns)
            foreach (MyGunBase gun in GetMountedWeaponsWithHarvesterAndDrill())
            {
                MyIntersectionResultLineTriangleEx?intersectionGun;
                gun.GetIntersectionWithLine(ref line, out intersectionGun);
                result = MyIntersectionResultLineTriangleEx.GetCloserIntersection(ref result, ref intersectionGun);
            }

            return(result);
        }
示例#4
0
        public static MyIntersectionResultLineTriangleEx?GetIntersectionWithLine(ref MyLine line)
        {
            MyIntersectionResultLineTriangleEx?result = null;

            //  Check all voxel maps
            for (int value = 0; value < m_voxelMaps.Count; value++)
            {
                MyIntersectionResultLineTriangleEx?testResultEx;
                m_voxelMaps[value].GetIntersectionWithLine(ref line, out testResultEx);

                //  If intersection occured and distance to intersection is closer to origin than any previous intersection)
                result = MyIntersectionResultLineTriangleEx.GetCloserIntersection(ref result, ref testResultEx);
            }

            return(result);
        }