posts - 310, comments - 0, trackbacks - 0, articles - 0
  C++博客 :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理
The crowd manager is the big beast of the navigation components. It not only handles a lot of the path management for you, but also local steering and dynamic avoidance between navigation clients. I.e. It can keep your agents from running into each other.
【CrowdManager】类是十分庞杂的一个类。它不仅为你处理了非常多的路径管理相关的事情,同时也处理一些局部转向和避开其它寻路代理对象。也就是说,他可以让所有的代理对象不会相互穿插。


Core Class: CrowdManager
核心类:CrowdManager


The NavmeshQuery and PathCorridor classes provide perfectly good, easy to use path planning features. But in the end they only give you points that your navigation client should be moving toward. When it comes to deciding things like client velocity and steering to avoid other clients, that is up to you to implement. Unless, of course, you decide to use the crowd manager.
NavmeshQuery和PathCorridor这两个类已经很不错了,用来做路径规划也足够简单。但是说到底它们只是给了你一堆指导角色运动的路点。当你决定实现一些角色之间不发生碰撞的特性时,只能你自己实现了。除非,当然,你决定使用CrowdManager。


Basically, you add an navigation client (agent) to the crowd manager, providing various configuration settings such as maximum speed and acceleration. You also provide a local target to more toward. The crowd manager then provides, with every update, the new agent position and velocity for the frame. The movement will be constrained to the navigation mesh, and steering will be applied to ensure agents managed by the crowd manager do not collide with each other.
基本上来讲,你可以往CrowdManager添加一个角色,同时提供一些配置数据,例如最大速度和加速度。你也可以提供一个局部的目标(让角色自主的移动过去(1))。然后CrowdManager会在每帧更新的时候设置角色的最新位置和速度。运动会被约束在Navmesh内,CrowdManager会让角色在需要的时候进行转向,以确保不会相互碰。


This is very powerful feature set. But it comes with limitations.
The biggest limitation is that you must give control of the agent's position and velocity completely over to the crowd manager. You can update things like maximum speed and acceleration. But in order for the crowd manager to do its thing, it can't allow you to constantly be giving it overrides to position and velocity. So you give up direct control of the agent's movement. It belongs to the crowd manager.
The second biggest limitation revolves around the fact that the crowd manager deals with local planning. The agent's target should never be more than 256 polygons aways from its current position. If it is, you risk your agent failing to reach its target. So you may still need to do long distance planning and provide the crowd manager with intermediate targets.


这是一个非常强大的特性集。但是它伴随着一些限制。
最大的限制在于你必须将角色的位置和速度完全交给CrowdManager来控制。你可以更新类似最大速度和加速度之类的参数。但是为了让CrowdManager能正常工作,你不能经常的改变角色的位置和速度。因此你需要放弃管理角色运动。这个工作现在属于CrowdManager。




Other significant limitations:
All agents using the crowd manager use the same NavmeshQueryFilter.
Crowd management is relatively expensive. The maximum agents under crowd management at any one time is around 20.


其他明显的限制
所有托管的角色都使用同样的查询过滤器
人群管理的开销相对较大。可以管理的人群的个体数量最大约为20个(1)。


The Sample Pack includes a Crowd Manager Demo that lets you see the manager in action.




(1)需要实验?
(1)这个数量是一个人为的限制,可以通过修改代码突破此限制。