diff --git a/Source/Engine/Navigation/NavCrowd.cpp b/Source/Engine/Navigation/NavCrowd.cpp index a41ead184..5be3e969a 100644 --- a/Source/Engine/Navigation/NavCrowd.cpp +++ b/Source/Engine/Navigation/NavCrowd.cpp @@ -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) diff --git a/Source/Engine/Navigation/NavCrowd.h b/Source/Engine/Navigation/NavCrowd.h index e416bfb96..f14ca7a08 100644 --- a/Source/Engine/Navigation/NavCrowd.h +++ b/Source/Engine/Navigation/NavCrowd.h @@ -31,6 +31,14 @@ public: /// True if failed, otherwise false. API_FUNCTION() bool Init(float maxAgentRadius = 100.0f, int32 maxAgents = 25, NavMesh* navMesh = nullptr); + /// + /// Initializes the crowd. + /// + /// The properties of the agents that will be added to the crowd. + /// maximum number of agents the crowd can manage. + /// True if failed, otherwise false. + API_FUNCTION() bool Init(const NavAgentProperties& agentProperties, int32 maxAgents = 25); + /// /// Initializes the crowd. ///