Add NavCrowd initialization with specific NavAgentProperties to pick a proper navmesh automatically
This commit is contained in:
@@ -23,6 +23,12 @@ bool NavCrowd::Init(float maxAgentRadius, int32 maxAgents, NavMesh* navMesh)
|
||||
return Init(maxAgentRadius, maxAgents, navMeshRuntime);
|
||||
}
|
||||
|
||||
bool NavCrowd::Init(const NavAgentProperties& agentProperties, int32 maxAgents)
|
||||
{
|
||||
NavMeshRuntime* navMeshRuntime = NavMeshRuntime::Get(agentProperties);
|
||||
return Init(agentProperties.Radius * 3.0f, maxAgents, navMeshRuntime);
|
||||
}
|
||||
|
||||
bool NavCrowd::Init(float maxAgentRadius, int32 maxAgents, NavMeshRuntime* navMesh)
|
||||
{
|
||||
if (!_crowd || !navMesh)
|
||||
|
||||
@@ -31,6 +31,14 @@ public:
|
||||
/// <returns>True if failed, otherwise false.</returns>
|
||||
API_FUNCTION() bool Init(float maxAgentRadius = 100.0f, int32 maxAgents = 25, NavMesh* navMesh = nullptr);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the crowd.
|
||||
/// </summary>
|
||||
/// <param name="agentProperties">The properties of the agents that will be added to the crowd.</param>
|
||||
/// <param name="maxAgents"> maximum number of agents the crowd can manage.</param>
|
||||
/// <returns>True if failed, otherwise false.</returns>
|
||||
API_FUNCTION() bool Init(const NavAgentProperties& agentProperties, int32 maxAgents = 25);
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the crowd.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user