| 156 | } |
| 157 | |
| 158 | bool NavMeshRuntime::TestPath(const Vector3& startPosition, const Vector3& endPosition) const |
| 159 | { |
| 160 | ScopeLock lock(Locker); |
| 161 | const auto query = GetNavMeshQuery(); |
| 162 | if (!query || !_navMesh) |
| 163 | return false; |
| 164 | |
| 165 | dtQueryFilter filter; |
| 166 | InitFilter(filter); |
| 167 | Float3 extent = Properties.DefaultQueryExtent; |
| 168 | |
| 169 | Float3 startPositionNavMesh, endPositionNavMesh; |
| 170 | Float3::Transform(startPosition, Properties.Rotation, startPositionNavMesh); |
| 171 | Float3::Transform(endPosition, Properties.Rotation, endPositionNavMesh); |
| 172 | |
| 173 | dtPolyRef startPoly = 0; |
| 174 | if (!dtStatusSucceed(query->findNearestPoly(&startPositionNavMesh.X, &extent.X, &filter, &startPoly, nullptr))) |
| 175 | return false; |
| 176 | dtPolyRef endPoly = 0; |
| 177 | if (!dtStatusSucceed(query->findNearestPoly(&endPositionNavMesh.X, &extent.X, &filter, &endPoly, nullptr))) |
| 178 | return false; |
| 179 | |
| 180 | dtPolyRef path[NAV_MESH_PATH_MAX_SIZE]; |
| 181 | int32 pathSize; |
| 182 | const auto findPathStatus = query->findPath(startPoly, endPoly, &startPositionNavMesh.X, &endPositionNavMesh.X, &filter, path, &pathSize, NAV_MESH_PATH_MAX_SIZE); |
| 183 | if (dtStatusFailed(findPathStatus)) |
| 184 | return false; |
| 185 | if (dtStatusDetail(findPathStatus, DT_PARTIAL_RESULT)) |
| 186 | return false; |
| 187 | |
| 188 | return true; |
| 189 | } |
| 190 | |
| 191 | bool NavMeshRuntime::FindClosestPoint(const Vector3& point, Vector3& result) const |
| 192 | { |
nothing calls this directly
no test coverage detected