Posted on 2016-11-08 21:17
點點滴滴 閱讀(437)
評論(0) 編輯 收藏 引用 所屬分類:
19 源碼收集
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)這個數量是一個人為的限制,可以通過修改代碼突破此限制。