블로그 이미지
Every unexpected event is a path to learning for you.

카테고리

분류 전체보기 (2737)
Unity3D (817)
Programming (474)
Server (33)
Unreal (4)
Gamebryo (56)
Tip & Tech (228)
협업 (58)
3DS Max (3)
Game (12)
Utility (136)
Etc (96)
Link (32)
Portfolio (19)
Subject (90)
iOS,OSX (53)
Android (14)
Linux (5)
잉여 프로젝트 (2)
게임이야기 (3)
Memories (20)
Interest (38)
Thinking (38)
한글 (30)
PaperCraft (5)
Animation (408)
Wallpaper (2)
재테크 (18)
Exercise (3)
나만의 맛집 (3)
냥이 (10)
육아 (16)
Total
Today
Yesterday
04-19 00:04

1) NavMesh Layer 셋팅 방법..




2) NavMesh Layer 셋팅 후 Bake 하는 방법

   (링크 : http://docs.unity3d.com/Documentation/Components/class-NavMeshLayers.html)


NavMesh Layers (Pro only)

The primary task of the navigation system is finding the optimal path between two points in navigation-space. In the simplest case, the optimal path is the shortest path. However, in many complex environments, some areas are harder to move thru than others (for example, crossing a river can be more costly than running across a bridge). To model this, Unity utilizes the concept of cost and the optimal path is defined as the path with the lowest cost. To manage costs, Unity has the concept of Navmesh Layers. Each geometry marked up as Navmesh Static will belong to a Navmesh Layer.

During pathfinding, instead of comparing lengths of potential path segments, the cost of each segment is evaluated. This is a done by scaling the length of each segment by the cost of the navmesh layer for that particular segment. Note that when all costs are set to 1, the optimal path is equivalent to the shortest path.

To define custom layers per project

  • Go to Edit->Project Settings->Navmesh Layers
  • Go to one of the user layers, and set up name and cost
    • The name is what will be used everywhere in the scene for identifying the navmesh layer
    • The cost indicates how difficult it is to traverse the NavMesh layer. 1 is default, 2.0 is twice as difficult, 0.5 is half as difficult, etc.
  • There are 3 built-in layers
    • Default - specifies the cost for everything not otherwise specified
    • Not walkable - the cost is ignored
    • Jump - the cost of automatically generated off-mesh links

To apply custom layers to specific geometry

  • Select the geometry in the editor
  • Pull up the Navigation Mesh window (Window->Navigation)
  • Go to the Object tab, and select the desired Navigation layer for that object
  • If you have Show NavMesh enabled in the Navmesh Display window, the different layers should show up in different colors in the editor.

To tell an agent what layers he can or cannot traverse

  • Go to the NavMeshAgent component of the agent's geometry
  • Modify NavMesh Walkable property
  • Don't forget to set the agent's destination property from a script

Note: Setting the cost value below 1 is not recommended, as the underlying pathfinding method does not guarantee an optimal path in this case

One good use case for using Navmesh Layers is:

  • You have a road that pedestrians (NavmeshAgents) need to cross.
  • The pedestrian walkway in the middle is the preferred place for them to go
  • Set up a navmesh layer with high cost for most of the road, and a navmesh layer with a low cost for the pedestrian walkway.
  • This will cause agents to prefer paths that go thru the pedestrian walkway.

Another relevant topic for advanced pathfinding is Off-mesh links 


반응형
Posted by blueasa
, |