Unity新版NavMesh组件使用文档

所需积分/C币:26 2018-08-24 10:50:45 917KB PDF
收藏 收藏
举报

Unity新版NavMesh组件使用文档,可运行时烘焙导航网格
v a v Nav Mesh Surface (Script R=0.5 075 H=2 45 Agent Type [Humanoid llect objects A Include Layers EVerything Use Geometry I Render Meshes Advanced ault Area Walkable Override Voxel Size口 Voxel Size 0.1666667 3.00 voxels per agent radius Override Tile Size口 Tile size 256 42.67 world unit Build Height Mesh ) Debug Clear Bake The main settings will cater for most use cases, but for anything not covered by the mair settings, the advanced section has the following additional parameters Default Area -defines the area type generated when building the navmesh the default value is Walkable. The NavMesh Modifer component can be used to modify the area type in more detail Override Voxel size- The override voxel size controls how accurately the input geometry is processed for NavMesh baking. It is a tradeoff between speed and accuracy. a good value to start with is 3 voxels per agent radius( 6 per diameter). This allows to capture most of the narrow passages, like doors and still have quick baking. If you have big open areas, you might go down to 1 or 2 to speed things up. Or if you have tight indoor spots you can use smaller voxels, and use maybe 4-6 voxels per radius More than 8 is usually not really worth it Override Tile size- In order to make the bake process parallel and memory efficient, the world is divided into tiles for baking. The white lines you can see on your NavMesh are tile boundaries. The default tiles size is 256 voXels. It is a good trade-off between memory usage and NavMesh fragmentation. The smaller the tiles are the more fragmented the NavMesh is, and this can sometimes cause non-optimal paths. NavMesh carving also operates on tiles. If you have a lot of obstacles, you can potentially speed ap carving by making the tile size smaller, say 64-128. Also, if you plan to bake the NavMesh at runtime you may choose to use smaller tile size to keep the maximum memory usage low Build Height Mesh- Not supported ye Advaneed-Debug[Net yet -] anced Default area I kable Manual Voxel size國 Voxel Size 0.1666657 3.00 voxe s per agent rad Manual Tile s Tile si 42 67 world units Build Height Mesh口 ebug Show Input G Show Voxels Show re Focus Point Show Raw Conto Show Contours口 Show Poly Mesh口 Show poly Mesh國 Use Debug F Focus Point X52129Y0209289 Debug options will show various visualizations cf the build procass. The pressed and shown at the location of the pr bake, and are not stored to disk. The debug visualization is -not generally-needed but when things go-south,this can be-a valuable teel- te let ts help-yeu-te fine the ct+prit ster - the maymesh huilding precess frem input scene fexelizatien te-fegien-splittinAg eentouf generation and-finally the Nawesh-pelygenS Sinee-the precess-ean-generate-a-let-ef data, seme-ef which-ewerlapping, the fecthS-Peints-helps-yeute RaFFew-dew4A the-visualizatieA for just one-tile NayMesh modifier Transform Position x-65078Y-4.0629z-14055 Rotation X0 Y0 Scale 21 V Group_2(Mesh Filter) 回焱 Mesh Igroup 2 c d Mesh Renderer 森 Y Nav Mesh Modifier (Script) xperimental Feature gnore From Build口 Override Area Type v Area Typ Affected Agents All Steve Book Shader Standard Add Component NavMesh Modifier allows to fine tune how a specific object behaves during NavMesh baking. In the above picture, the lower platform has modifier attached to it, which sets the object to have Lava area type The NavMesh Modifier affects hierarchically, that is, the Game object where the Components is attached and all of its' children are affected if another nay mesh modifier is found further down the transform hierarchy it will override the modification for its children The NavMesh Modifier affects the NavMesh generation process, this means the NavMesh has to be updated to reflect changes to NavMesh Modifiers Note: This component is a replacement for the old setting which could be enabled from the Navigation window Objects tab as well as the static flags dropdown on the Game object. This component is available for baking at runtime, whereas the static flags are available in the editor only Parameters Ignore From Build-when checked, the object and all if its children are skipped from the build process Override Area Type -when checked the area type will be overridden for the game object containing the Modifier and all of it's children o Area Type -new area type to apply Affected Agents-a selection of agents the Modifier affects. For example, you may choose to exclude certain obstacles from specific agent NavMesh modifier volume V Nav Mesh Modifier Volume( Scrip圜獠 Experi mental Feature SIze X2.509589Y3 Center x-0.129358Y1 凸 Edit volume Affected Agents LAIl Add componen NavMesh Modifier Volume allows you to mark the area that falls inside the volume with specific area type Where NavMesh Modifier marks certain objects with an area type, the Modifier Volume allows change the area type even more locally based on a volume The modifier is useful for annotating certain areas over walkable surfaces which might not be represented as separate geometry, e.g. danger areas. It can be even be used to make certain areas non-walkable The NavMesh Modifier Volume affects the NavMesh generation process, this means the NavMesh has to be updated to reflect changes to navMesh modifier Volumes Parameters Size-dimensions of the modifier volume Center-center of the modifier volume relative to the gameobject center Area Type- describes the area type which the volume applies Affected Agents-a selection of agents the Modifier affects. For example, you may choose to create danger zone for specific agent type only NavMesh link VA Nav Mesh Link(Script) Experimental Feature Agent Ty HUmanoid Start Point x-1.192093Y-0294735:Z-182031 End point X-3576279Y037334927182031 Width 459107 Align transform To point Bid rectional Area Type walkable Add Component NavMesh Link allows to create a navigable link between two locations. the link can be from point-to-point, or it can be wider in which case the agent uses the nearest location along entry edge to cross the link The link is necessary to connect different NavMesh Surfaces Agent Type -the agent type which can use the link Start Point-start point of the link, relative to the Game object End Point -end point of the link, relative to the Game object Align Transform To Points-clicking this button will move the game Object at the links center point and alight the transform's forward axis towards the end point Cost Modifier- When the cost modifier value is non-negative the cost of moving over the NavMesh Link is equivalent to the cost modifier value times the Euclidean distance between NavMesh Link end points Bidirectional- when checked the link can be traversed from start-to-end and end-to-start, when unchecked only from start-to-end Area Type -the area type of the link(affects path finding cost Techniques Connecting Multiple navMesh Surfaces Together #F Scene s Game a Inspecto L Navigatio eLi 2D※ Gizmos"@A -v NavMesh Link 口 Static w Tag Untagged : LayerDefault Position X-1.15 Y2.72053Z-757 Rotation X0 Y10646920 X 1 <Persp vA Nav Mesh Link(Script) Agent Typ Humanoid Start Point x0Y1.186712-1.36527 Y11867121.36527 Width 5.993601 Align Transform To Po nt Bidirectional Area Type I Walkable Add con If it is desired to allow an agent to move along multiple NavMesh Surfaces in a Scene, the surfaces need to be connected together using NavMesh Links In the example scene above, the blue and red navmeshes are defined in different Navmesh Surfaces. A wide NavMesh Link is added it spans from one surface to another Things to keep in mind when connecting surfaces: You can connect surfaces using multiple links Both the surfaces and the link must have same agent type The link,'s start and end point must be only on one surface. It is ok to have multiple NavMeshes at the same location, but then selecting a NavMesh becomes ambiguous If you are loading a second NavMesh Surface additively and you have dangling links in the first scene, check that they do not connect to unwanted surfaces API Reference NavMesh surface Properties agent Type/d-Id describing the agent type the navMesh should be built for collectobjects- defines how input geometry is collected from the scene, one of UnityEngine. Al. Collectobjects o All-use all objects in the scene o Volume-use all objects in the scene which touch the bounding volume(see size and center o Children-use all objects which are children to the Game object where the NavMesh Surface is attached to size-dimensions of the build volume. The size is not affected by scaling center-center of the build volume relative to the transform center layerMask-bitmask defining the layers on which the objects must be to be included in the baking use Geometry -defined which geometry is used for baking, one of UnityEngine. Al NavMesh CollectGeometry o RenderMeshes-use geometry from render meshes and terrains o Physics Colliders-use geometry from colliders and terrains defaultArea-default area type for all input geometries, unless otherwise specified ignore NavMeshAgent -true if Game Objects with a NavMeshAgent components should be ingnored as input ignore NavMesh obstacle-true if game objects with a NavmeshAgent components should be ingnored as input override ile size- true if tile size is set tile Size-tile size in voxels(the component desc has explanation how to choose tile size override voxe size- true if the voxel size is set voXe/Size- size of the voxel in world units(the component desc has explanation how to choose tile size buildHeightMesh-not implemented navMesh Data-reference to the navmesh Data the surface uses, or null if not set e active Surfaces-list of all active Nay Mesh Surfaces Note: The above values affect how the bake results, thus, you must call BuildNavMesho to make them count Public functions void buildnavMesh ( Builds a new NavMesh Data based on the parameters set on NavMesh Surface. The data can be accessed via navMesh Data NavMesh modifier Properties overrideArea -true if the modifier overrides area type area- new area type to apply ignore FromBuild-true if the Gameobject which contains the modifier and its children should be not be used to NavMesh baking active Modifiers -list of all active Naymesh Modifiers Public functions bool AffectsAgentfype(int agentTypeID) Returns true if the modifier applies to the specified agent type, otherwise false NavMesh modifier volume Properties size- size of the bounding volume in local space units. Transform affects the size center-center of the bounding volume in local space units. Transform affects the center area -area type to apply for the Navmesh areas that are inside the bounding volume Public functions bool AffectsAgentType(int agentTypeID) Returns true of thethe modifier applies for the specified agent type NavMesh link Properties agentTypelD-the type of agent that can use the link startPoint- start point of the link in local space units. Transform affects the location o endPoint -end point of the link in local space units. Transform affects the location width-width of the link in world length units costModifier-when the cost modifier value is non-negative the cost of moving over the NavMesh Link is equivalent to the cost modifier value times the euclidean distance between NavMesh Link end points bidirectional-if true the link can be traversed both ways, if false the link can be traversed only from start to end autoUpdate -if true the link updates the endpoints to follow the transform of the Game object every frame

...展开详情
试读 11P Unity新版NavMesh组件使用文档
立即下载 低至0.43元/次 身份认证VIP会员低至7折
    抢沙发
    一个资源只可评论一次,评论内容不能少于5个字
    关注 私信 TA的资源
    上传资源赚积分,得勋章
    最新推荐
    Unity新版NavMesh组件使用文档 26积分/C币 立即下载
    1/11
    Unity新版NavMesh组件使用文档第1页
    Unity新版NavMesh组件使用文档第2页
    Unity新版NavMesh组件使用文档第3页
    Unity新版NavMesh组件使用文档第4页

    试读已结束,剩余7页未读...

    26积分/C币 立即下载 >