private void TestPath() { using (m_lock.AcquireExclusiveUsing()) { if (m_grid.MarkedForClose) { CurrentState = State.BlockedPath; m_cells.Clear(); return; } if (CurrentState == State.None) { m_cells.Clear(); return; } //MyGameTimer timer = new MyGameTimer(); if (m_cells.Count != 0) { Vector3D worldPos = m_grid.GridIntegerToWorld(m_cells.Dequeue()); LineD worldLine = new LineD(worldPos, worldPos + m_displacement); //var createLine = timer.Elapsed; //timer = new MyGameTimer(); Vector3D?contact; if (RayCast.RayCastVoxel(gravcomp, worldLine, out contact)) { //var intersect = timer.Elapsed; m_logger.debugLog("Intersected line: " + worldLine.From + " to " + worldLine.To + ", at " + contact, Logger.severity.DEBUG); //m_logger.debugLog("Intersected line: " + worldLine.From + " to " + worldLine.To + ", at " + contact + ", createLine: " + createLine.ToPrettySeconds() + ", intersect: " + intersect.ToPrettySeconds(), "TestPath()", Logger.severity.DEBUG); ObstructionPoint = contact.Value; CurrentState = State.BlockedPath; m_cells.Clear(); return; } //else //{ // var intersect = timer.Elapsed; // m_logger.debugLog("no intersection with line: " + worldLine.From + " to " + worldLine.To + ", createLine: " + createLine.ToPrettySeconds() + ", intersect: " + intersect.ToPrettySeconds(), "TestPath()", Logger.severity.TRACE); //} DoTests.Enqueue(TestPath); } else { m_logger.debugLog("finished, clear", Logger.severity.DEBUG); CurrentState = State.Clear; } } }