MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / FindRandomPoint

Method FindRandomPoint

Source/Engine/Navigation/NavMeshRuntime.cpp:217–237  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

215}
216
217bool NavMeshRuntime::FindRandomPoint(Vector3& result) const
218{
219 ScopeLock lock(Locker);
220 const auto query = GetNavMeshQuery();
221 if (!query || !_navMesh)
222 return false;
223
224 dtQueryFilter filter;
225 InitFilter(filter);
226
227 dtPolyRef randomPoly = 0;
228 Float3 randomPt;
229 if (!dtStatusSucceed(query->findRandomPoint(&filter, Random::Rand, &randomPoly, &randomPt.X)))
230 return false;
231
232 Quaternion invRotation;
233 Quaternion::Invert(Properties.Rotation, invRotation);
234 Vector3::Transform(randomPt, invRotation, result);
235
236 return true;
237}
238
239bool NavMeshRuntime::FindRandomPointAroundCircle(const Vector3& center, float radius, Vector3& result) const
240{

Callers

nothing calls this directly

Calls 6

GetNavMeshQueryFunction · 0.85
InitFilterFunction · 0.85
dtStatusSucceedFunction · 0.85
findRandomPointMethod · 0.80
InvertFunction · 0.50
TransformClass · 0.50

Tested by

no test coverage detected