| 62 | } |
| 63 | |
| 64 | bool NavMeshRuntime::FindDistanceToWall(const Vector3& startPosition, NavMeshHit& hitInfo, float maxDistance) const |
| 65 | { |
| 66 | ScopeLock lock(Locker); |
| 67 | const auto query = GetNavMeshQuery(); |
| 68 | if (!query || !_navMesh) |
| 69 | return false; |
| 70 | |
| 71 | dtQueryFilter filter; |
| 72 | InitFilter(filter); |
| 73 | Float3 extent = Properties.DefaultQueryExtent; |
| 74 | |
| 75 | Float3 startPositionNavMesh; |
| 76 | Float3::Transform(startPosition, Properties.Rotation, startPositionNavMesh); |
| 77 | |
| 78 | dtPolyRef startPoly = 0; |
| 79 | if (!dtStatusSucceed(query->findNearestPoly(&startPositionNavMesh.X, &extent.X, &filter, &startPoly, nullptr))) |
| 80 | return false; |
| 81 | |
| 82 | Float3 hitPosition, hitNormal; |
| 83 | if (!dtStatusSucceed(query->findDistanceToWall(startPoly, &startPositionNavMesh.X, maxDistance, &filter, &hitInfo.Distance, &hitPosition.X, &hitNormal.X))) |
| 84 | return false; |
| 85 | |
| 86 | Quaternion invRotation; |
| 87 | Quaternion::Invert(Properties.Rotation, invRotation); |
| 88 | Vector3::Transform(hitPosition, invRotation, hitInfo.Position); |
| 89 | Vector3::Transform(hitNormal, invRotation, hitInfo.Normal); |
| 90 | |
| 91 | return true; |
| 92 | } |
| 93 | |
| 94 | bool NavMeshRuntime::FindPath(const Vector3& startPosition, const Vector3& endPosition, Array<Vector3, HeapAllocation>& resultPath, NavMeshPathFlags& resultFlags) const |
| 95 | { |
nothing calls this directly
no test coverage detected