navmeshes · • variation on piano movers problem (a) (b) h ok too short too steep. creating...
TRANSCRIPT
![Page 1: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/1.jpg)
NavMeshesCMSC425.01Spring2019
Stillattables…
![Page 2: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/2.jpg)
Administrivia
• Hw2posted
• Project2outlineready,fulldescriptionsoon
• Practiceexamslinked
• Anychoicesonwhatwedoafterbreak?• Gamedesignbigsubject,lotsoftopicswecanchoosefrom
![Page 3: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/3.jpg)
Project2:CrabSoup,Anyone?
• Goal:Playermustretrievetreasurefromchestonfarisland• Problem:MutatedCrabswillattack
![Page 4: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/4.jpg)
Project2:CrabSoup,Anyone?
• Goal:Playermustretrievetreasurefromchestonfarisland• Problem:MutatedCrabswillattack
• NewUnityelements:• Terrain• NavMesh• AnimatedfiguresforPlayerandCrabs
![Page 5: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/5.jpg)
![Page 6: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/6.jpg)
Yourinstructorplays…
![Page 7: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/7.jpg)
Details
• Part1:Makeittothetreasure!MakeaterrainwithaNavMesh,navigatetotheTreasure,andhavetheCrabschase.Playerhumanoid,Crabsblocks.Winifyoumakeittothetreasurewithoutbeing“crabbed”
• Part2:AnimatePlayerandCrabswithMixamo animations.Addakeythatmustbefoundtoopenchest,returntodocktowin.AddUIgraphictoshowthatkeyispickedup.
• Reach?:Makeitunderwaterwithswimminganimation• Freeto:addelementstomakeitmoreplayable,changethemeifspiritiskept
![Page 8: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/8.jpg)
Today’squestion
HowNPCsmovearound:NavMeshes
![Page 9: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/9.jpg)
Navigationproblems• Navigatingfromplacetoplace• Densecrowdnavigation• Coordinatedteammovement• Pursuit• Movingcomplex/articulatedshape
• Pianomoversproblem(rigid)• Skeleton(articulated)
![Page 10: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/10.jpg)
@UMD:DineshandMing
• Densecrowdsimulations• Howtomovemanyagentsnaturally
• Video
![Page 11: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/11.jpg)
NavigationVersion1:UseamapCreategraphstructureUseDijkstra'salgorithm
Shortestpath
Assumption:Worldisrigid,limitedlanesformovement
![Page 12: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/12.jpg)
Whatis"shortest"path?
• Distance?
![Page 13: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/13.jpg)
Whatis"shortest"path?
• Distance?• Speed?• Energycost?• Exposuretoenemy?
• Hexmap• 6directions• Terraintypes=>speedcosts
![Page 14: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/14.jpg)
NavigationVersion2:OpenTerrain
• Mixofobstaclesandopenspaces:"freespacegeometry"• Moreoptionsfordirection• Howpickpath?
![Page 15: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/15.jpg)
Howpickbestpath?
• Shortestmaynotbemostnatural(dashedline)• Needwaytodetectnaturalcorridors
![Page 16: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/16.jpg)
Solution1:Waypointroadmap
• Preprocessspaceintographofwaypoints• Placewaypointsalongnaturalcorridors
![Page 17: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/17.jpg)
Solution1:Waypointroadmap
• Preprocessspaceintographofwaypoints• Placewaypointsalongnaturalcorridors• Drawbacks• Couldneedlotsofwaypoints• Hardertoplanforcoordinatedteammovement
![Page 18: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/18.jpg)
Solution2:Navmesh
• Preprocessspaceintomeshoffreeareasaspolygons• Planmovementbetweenpolygons• Betweenedges• Betweencenters
• Multiplelevelgraphsearch• Firstbetweenregions• Thenpickentryandexitpoints
![Page 19: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/19.jpg)
Navmeshes canbe
• Labeledwithdifferentterraintypes• Setwith"gates"
• 2Dmanifoldswhicharetopologicallycomplex(eg,non-planar)
![Page 20: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/20.jpg)
UsingNavmesh
• Insideregionusedirectpath
• Regions(andsubregions)canbelabeledwithdifferentterraintypesandcosts
![Page 21: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/21.jpg)
CreatingNavmeshes fromterrain
• Step1:Findwalkablesurfaces• Aslargepolygon"map"
• Step2:Simplifyboundaries• Simplifypolygon"map"
• Step3:Triangulate"map"• Coverwithsetoftriangles
![Page 22: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/22.jpg)
CreatingNavmeshes fromterrain
• Step1:Findwalkablesurfacesbasedonagentheight,width,slopeability
• Variationonpianomoversproblem
(a) (b)
h
too shortok
too steep
![Page 23: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/23.jpg)
CreatingNavmeshes fromterrain
• Step2:Simplifyboundaries• Simplifypolygon"map"
• Recursiverefinementofstraightline
![Page 24: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/24.jpg)
CreatingNavmeshes fromterrain
• Step3:Triangulate"map"• Coverwithsetoftriangles
• Bridgeholes• Cutears(!)
(a) (b)
v0
v1v2
vi�1
vi+1
viear
(c)
vn
chord
chordbridging
![Page 25: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/25.jpg)
UseNavmesh:findpath
• Discretizebyaddingpoints• Findshortestpath
(b) (c)(a)
![Page 26: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/26.jpg)
UseNavmesh:refine
• Smoothandcleanpath
(a) (b) (c)
t
s
t
s
t
s
![Page 27: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/27.jpg)
Navmeshes inUnity
• Createterrain• Terraineditor
• Setagentnavigationproperties• Height,widthofagent• Slopecapability
• BakeNavmesh• Findsnavigableregions• Createsmesh
![Page 28: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/28.jpg)
Agentproperties
• Radius,Height• Stepheight• Maxslope
• Canhavemultipleagenttypes
![Page 29: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/29.jpg)
Offmeshlinks
![Page 30: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/30.jpg)
Question
• Howdoesthisallrelatetocolliders?
![Page 31: NavMeshes · • Variation on piano movers problem (a) (b) h ok too short too steep. Creating Navmeshesfrom terrain • Step 2: Simplify boundaries • Simplify polygon "map" •](https://reader034.vdocuments.site/reader034/viewer/2022050421/5f90cd64a045237b722a9ee0/html5/thumbnails/31.jpg)
Readings
• LookatUnitymanualandtutorials• Terrain• https://docs.unity3d.com/Manual/terrain-UsingTerrains.html
• NavMesh• https://unity3d.com/learn/tutorials/topics/navigation/navmesh-agent• https://docs.unity3d.com/Manual/nav-BuildingNavMesh.html
• Animation• https://unity3d.com/learn/tutorials/topics/animation/animate-anything-mecanim• https://unity3d.com/learn/tutorials/s/animation