Rename Navigation.ProjectPoint into Navigation.FindClosestPoint to have consistent API naming

#2034
This commit is contained in:
Wojtek Figat
2024-02-17 09:07:37 +01:00
parent 17361d6bc1
commit 5de5e576e5
5 changed files with 33 additions and 9 deletions

View File

@@ -474,8 +474,8 @@ BehaviorUpdateResult BehaviorTreeMoveToNode::Update(const BehaviorUpdateContext&
state->NavAgentRadius = navMesh->Properties.Agent.Radius;
// Place start and end on navmesh
navMesh->ProjectPoint(state->Path.First(), state->Path.First());
navMesh->ProjectPoint(state->Path.Last(), state->Path.Last());
navMesh->FindClosestPoint(state->Path.First(), state->Path.First());
navMesh->FindClosestPoint(state->Path.Last(), state->Path.Last());
// Calculate offset between path and the agent (aka feet offset)
state->AgentOffset = state->Path.First() - agentLocation;

View File

@@ -194,7 +194,7 @@ bool NavMeshRuntime::TestPath(const Vector3& startPosition, const Vector3& endPo
return true;
}
bool NavMeshRuntime::ProjectPoint(const Vector3& point, Vector3& result) const
bool NavMeshRuntime::FindClosestPoint(const Vector3& point, Vector3& result) const
{
ScopeLock lock(Locker);
const auto query = GetNavMeshQuery();

View File

@@ -146,12 +146,24 @@ public:
API_FUNCTION() bool TestPath(const Vector3& startPosition, const Vector3& endPosition) const;
/// <summary>
/// Projects the point to nav mesh surface (finds the nearest polygon).
/// Finds the nearest point on a nav mesh surface.
/// </summary>
/// <param name="point">The source point.</param>
/// <param name="result">The result position on the navmesh (valid only if method returns true).</param>
/// <returns>True if found valid location on the navmesh, otherwise false.</returns>
API_FUNCTION() bool ProjectPoint(const Vector3& point, API_PARAM(Out) Vector3& result) const;
API_FUNCTION() bool FindClosestPoint(const Vector3& point, API_PARAM(Out) Vector3& result) const;
/// <summary>
/// Projects the point to nav mesh surface (finds the nearest polygon).
/// [Deprecated in v1.8]
/// </summary>
/// <param name="point">The source point.</param>
/// <param name="result">The result position on the navmesh (valid only if method returns true).</param>
/// <returns>True if found valid location on the navmesh, otherwise false.</returns>
API_FUNCTION() bool ProjectPoint(const Vector3& point, API_PARAM(Out) Vector3& result) const
{
return FindClosestPoint(point, result);
}
/// <summary>
/// Finds random location on nav mesh.

View File

@@ -325,11 +325,11 @@ bool Navigation::TestPath(const Vector3& startPosition, const Vector3& endPositi
return NavMeshes.First()->TestPath(startPosition, endPosition);
}
bool Navigation::ProjectPoint(const Vector3& point, Vector3& result)
bool Navigation::FindClosestPoint(const Vector3& point, Vector3& result)
{
if (NavMeshes.IsEmpty())
return false;
return NavMeshes.First()->ProjectPoint(point, result);
return NavMeshes.First()->FindClosestPoint(point, result);
}
bool Navigation::FindRandomPoint(Vector3& result)

View File

@@ -40,12 +40,24 @@ public:
API_FUNCTION() static bool TestPath(const Vector3& startPosition, const Vector3& endPosition);
/// <summary>
/// Projects the point to nav mesh surface (finds the nearest polygon).
/// Finds the nearest point on a nav mesh surface.
/// </summary>
/// <param name="point">The source point.</param>
/// <param name="result">The result position on the navmesh (valid only if method returns true).</param>
/// <returns>True if found valid location on the navmesh, otherwise false.</returns>
API_FUNCTION() static bool ProjectPoint(const Vector3& point, API_PARAM(Out) Vector3& result);
API_FUNCTION() static bool FindClosestPoint(const Vector3& point, API_PARAM(Out) Vector3& result);
/// <summary>
/// Projects the point to nav mesh surface (finds the nearest polygon).
/// [Deprecated in v1.8]
/// </summary>
/// <param name="point">The source point.</param>
/// <param name="result">The result position on the navmesh (valid only if method returns true).</param>
/// <returns>True if found valid location on the navmesh, otherwise false.</returns>
API_FUNCTION() DEPRECATED static bool ProjectPoint(const Vector3& point, API_PARAM(Out) Vector3& result)
{
return FindClosestPoint(point, result);
}
/// <summary>
/// Finds random location on nav mesh.