Posted on 2016-11-08 21:16
點點滴滴 閱讀(446)
評論(0) 編輯 收藏 引用 所屬分類:
19 源碼收集
The Path Corridor
翻譯:kun 2014.12.4
The path corridor provides a way of moving along a navigation path without worrying about the minutiae of managing the path.
廊道提供了一種沿指定導(dǎo)航路徑進行移動,而不必擔(dān)心管理使用路徑數(shù)據(jù)時的細節(jié)問題。
Core Class: PathCorridor
核心類:PathCorridor
In the simplest scenario, a path is a list of waypoints from a starting point to an end point. The waypoints form a connected set of line segments along which a navigation client moves. But
navigation is much more complex in the real world. There are locomotion limitations, local steering restrictions, dynamic obstacle avoidance, and good old floating point errors. All of these
issues can make management of a path difficult.
在最簡單的情景里,一個路徑是一組從開始點到結(jié)束點的路點列表。如果能精確的按照使用此導(dǎo)航數(shù)據(jù)運動,角色的軌跡會是一組相互連接的線段。但是在真實環(huán)境下進行導(dǎo)航比這個要復(fù)雜的多。你需要考慮角色的運
動能力的局限性(1)、局部轉(zhuǎn)向限制、避開動態(tài)障礙物、以及一些常見的浮點數(shù)錯誤。所有這些情況都會讓管理一個路徑的使用變得困難。
Navigation based on a polygon mesh provides a different abstraction than just a list of waypoints. The path returned by the NavmeshQuery class is a list of polygons. Technically, a client can
move freely anywhere within this corridor of polygons. If a client strays outside the corridor, then the corridor can be patched up using local searches rather than full path replanning.
在一個多邊形網(wǎng)格上進行導(dǎo)航比在一堆路點上進行導(dǎo)航要更加抽象一些。NavmeshQuery返回的Path是一組多邊形。技術(shù)上講,一個角色可以在這個廊道上的任意多邊形內(nèi)自由的移動。如果一個角色跑出了這個廊道的范
圍,廊道的范圍可以使用局部搜索進行擴大,而不是重新規(guī)劃整條路徑。
The path corridor is loaded with a path, a start point, and a target point. It is then used to move the navigation client through the corridor. It handles path straightening, constraining the
client to the navigation mesh, and adjusting the corridor due to inaccurate client locomotion.
廊道需要加載一個Path、一個起始點、一個目標點。然后用于角色在這個廊道內(nèi)移動。它處理路徑的矯正、確保角色不會跑出Navmesh、以及當角色移動超出預(yù)期時修正廊道信息。
The PathCorridor API is well documented. The only thing worth repeating here is a warning: You can't just initialize a corridor with a path and forget long distance path planning. Since the
path corridor class uses local searches to maintain the corridor, attempting to apply large delta movement to the corridor's position or target can result in a malformed corridor. Details are
in the API documentation.
PathCorridor API已經(jīng)有詳細的文檔說明了。在這里只有一點值得提一下:你不能只創(chuàng)建一個廊道然后一切都交給它去做,而不進行長路徑規(guī)劃。雖然廊道使用了局部搜索來維持廊道完整性,不過如果在廊道里產(chǎn)生一
個大的運動距離,或者目標點離得很遠,會產(chǎn)生一個畸形的廊道(1)。更多的細節(jié)可以參考相關(guān)API文檔。
(1)加速、減速、慣性之類的運動參數(shù).
(2)啥意思?