public MyIntersectionResultLineTriangleEx?GetIntersectionWithLine(MyEntity physObject, ref MyLine line, ref Matrix customInvMatrix, IntersectionFlags flags) { MyLine lineInModelSpace = new MyLine(MyUtils.GetTransform(line.From, ref customInvMatrix), MyUtils.GetTransform(line.To, ref customInvMatrix), true); //MyIntersectionResultLineTriangle? result = null; m_result.Start(m_model, lineInModelSpace, flags); var dir = new IndexedVector3(lineInModelSpace.Direction); var from = new IndexedVector3(lineInModelSpace.From); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("m_bvh.RayQueryClosest()"); m_bvh.RayQueryClosest(ref dir, ref from, m_result.ProcessTriangleHandler); MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); if (m_result.Result.HasValue) { return(new MyIntersectionResultLineTriangleEx(m_result.Result.Value, physObject, ref lineInModelSpace)); } else { return(null); } }
public MyIntersectionResultLineTriangleEx?GetIntersectionWithLine(IMyEntity entity, ref LineD line, ref MatrixD customInvMatrix, IntersectionFlags flags) { LineD lineInModelSpace = new LineD(Vector3D.Transform(line.From, ref customInvMatrix), Vector3D.Transform(line.To, ref customInvMatrix)); //MyIntersectionResultLineTriangle? result = null; m_result.Start(m_model, lineInModelSpace, flags); var dir = lineInModelSpace.Direction.ToBullet(); var from = lineInModelSpace.From.ToBullet(); VRageRender.MyRenderProxy.GetRenderProfiler().StartProfilingBlock("m_bvh.RayQueryClosest()"); m_bvh.RayQueryClosest(ref dir, ref from, m_result.ProcessTriangleHandler); VRageRender.MyRenderProxy.GetRenderProfiler().EndProfilingBlock(); if (m_result.Result.HasValue) { return(new MyIntersectionResultLineTriangleEx(m_result.Result.Value, entity, ref lineInModelSpace)); } else { return(null); } }