SlideShare a Scribd company logo
1 of 46
Download to read offline
INTERACTIVE OBJECTS IN
GAMING APPLICATIONS
Basic principles and practical scenarios in Unity
June 2013Stavros Vassos Sapienza University of Rome, DIAG, Italy vassos@dis.uniroma1.it
Interactive objects in games
2
 Pathfinding
 Part 1: A* heuristic search on a grid
 Part 2: Examples in Unity
 Part 3: Beyond the basics
 Action-based decision making
 AI Architectures
Pathfinding: Examples in Unity
3
Pathfinding: Examples in Unity
4
 We will use a sample project in Pathfinding.zip
 Based on
 Aron Granberg A* Pathfinding project (free version)
 http://arongranberg.com/astar/download
 http://arongranberg.com/astar/docs/getstarted.php
 3D Platformer Tutorial by Unity (free)
 http://u3d.as/content/unity-technologies/3d-platformer-
tutorial/
 Unzip, open project, and load scene “Pathfinding on
a plane” (it is already ready for experimentation)
Pathfinding: Examples in Unity
5
 We will use a sample project in Pathfinding.zip
 Based on
 Aron Granberg A* Pathfinding project (free version)
 http://arongranberg.com/astar/download
 http://arongranberg.com/astar/docs/getstarted.php
 3D Platformer Tutorial by Unity (free)
 http://u3d.as/content/unity-technologies/3d-platformer-
tutorial/
 Unzip, open project, and load scene “Pathfinding on
a plane” (it is already ready for experimentation)
Many other packages available, paid, free, or
freemium. You can also write your own!
Pathfinding: Examples in Unity
6
 Creating the scene
 Simple plane
 Rigid body (docs.unity3d.com:Rigidbody)
 Box collider (docs.unity3d.com:BoxCollider)
 Checkerboard material
 Crates
 Rigid body
 Box collider
 Some material that looks nice
Pathfinding: Examples in Unity
7
 Creating the scene
 Simple plane
 Rigid body (docs.unity3d.com:Rigidbody)
 Box collider (docs.unity3d.com:BoxCollider)
 Checkerboard material
 We want to note that this is the “ground” for navigation
 Crates
 Rigid body
 Box collider
 Some material that looks nice
 We want to note that these are “obstacles” for navigation
Pathfinding: Examples in Unity
8
 Tags: mostly for finding game objects
(docs.unity3d.com:Tags)
 Layers: mostly for rendering purposes
(docs.unity3d.com:Layers)
Pathfinding: Examples in Unity
9
 Here we specify two layers
 Ground
 Obstacles
 And set the plane and crates to
the correct one
Pathfinding: Examples in Unity
10
 Creating the scene
 Adding a character that we will instruct to move around
 Lerpz prefab from 3D Platformer Tutorial of Unity
 Character controller component
Pathfinding: Examples in Unity
11
 Essentially a capsule-shaped Collider
(docs.unity3d.com:CharacterController)
 Can be told to move in some direction from a script
 Can carry out the movement but be constrained by
collisions (also step offset, slope limit)
Pathfinding: Examples in Unity
12
 Aron’s pathfinding package
 Adding pathfinding functionality in the scene
 Create empty object
 Name it “A* Pathfinder”
 Add the AstarPath script from Aron’s package
 This is a unique central hub for computing paths
 Adding pathfiding functionality to the character
 Add the Seeker component
Pathfinding: Ex. in Unity
13
 Specify the parameters of the
AstarPath script
 Grid Graph
 Position/size
 4-connected/8-connected
 Cut corners
 Collision testing
 Type/size of collider
 Mask: Use Obstacle Layer
 Scan and observe!
Pathfinding: Ex. in Unity
14
 Capsule collider with diameter 2
 8-connected
Pathfinding: Ex. in Unity
15
 Capsule collider with diameter 2
 8-connected
“Cut corners”
option affects
these edges
Pathfinding: Ex. in Unity
16
 Capsule collider with diameter 6
 4-connected
Pathfinding: Examples in Unity
17
 Using the Seeker script to get paths for Lerpz
 Astar AI1
 Astar AI2
 Astar AI3
 Astar AI4
 Based on sample code in Aron’s pathfinding package
Pathfinding: Examples in Unity
18
 Using the Seeker script to get paths for Lerpz
public class AstarAI1 : MonoBehaviour {
public Vector3 targetPosition;
public void Start () {
//Get a reference to the Seeker component
Seeker seeker = GetComponent<Seeker>();
//Start a new path to the targetPosition,
//return the result to the OnPathComplete function
seeker.StartPath (transform.position,targetPosition,
OnPathComplete);
}
public void OnPathComplete (Path p) {
Debug.Log ("Yey, we got a path back!");
}
}
Pathfinding: Examples in Unity
19
 Astar A1 script calls the Seeker's StartPath function
 The Seeker creates a new Path instance and sends it to
the AstarPath script (in the A* Pathfinder game-object)
 AstarPath script puts the path in a queue, when
available, it processes the path by searching the grid in
the A* heuristic search manner we described earlier
 AstarPAth script calls the function OnPathComplete with
the path it found as a parameter p
 p.VectorPath holds a list of Vector3 objects that show
how the destination can be reached
Pathfinding: Examples in Unity
20
 Seeker option to display path via gizmos
Pathfinding: Examples in Unity
21
 Post-processing path via modifiers (here: Funnell mod.)
Pathfinding: Examples in Unity
22
 Using Astar AI1 script, Lerpz is able to find out how
to get to the target object (fuel cell prefab)
 So, let’s make Lerpz move!
 Accessing other components
(docs.unity3d.com:Accessing)
 SimpleMove function of Character component
(docs.unity3d.com:CharacterController.SimpleMove)
 FixedUpdate instead Update for physics-related things
(docs.unity3d.com:FixedUpdate,
unity3d.com/tutorials:Update-and-Fixedupdate)
Pathfinding: Examples in Unity
23
public class AstarAI2 : MonoBehaviour {
...
//The calculated path
public Path path;
//The character’s speed
public float speed = 100;
//The distance to a waypoint for moving to the next
public float nextWaypointDistance = 3;
//The waypoint we are currently moving towards
private int currentWaypoint = 0;
public void Start () {
... }
public void OnPathComplete (Path p) {
... }
public void FixedUpdate () {
... }
}
Pathfinding: Examples in Unity
24
public class AstarAI2 : MonoBehaviour {
public void FixedUpdate () {
//Check if we reached the destination
if (currentWaypoint >= path.vectorPath.Count) {
Debug.Log ("End Of Path Reached");
return;
}
//Direction to the next waypoint
Vector3 dir = (path.vectorPath[currentWaypoint]-
transform.position).normalized;
dir *= speed * Time.fixedDeltaTime;
controller.SimpleMove (dir);
//Check if we need to switch to the next waypoint
if (Vector3.Distance(transform.position,
path.vectorPath[currentWaypoint]) < nextWaypointDistance) {
currentWaypoint++;
return;
}
}
Pathfinding: Examples in Unity
25
 Lerpz moves but without animating its parts
 Basic animation of pre-defined clips
 Animation component (docs.unity3d.com:Animation)
 Play(“walk”), Stop()
Pathfinding: Examples in Unity
26
 Lerpz.fbx
 Embedded animations that have
been created outside of Unity for
the 3D model
 Available for
 Playing
 Looping
 Blending
Pathfinding: Examples in Unity
27
public class AstarAI3 : MonoBehaviour {
...
//Cashed reference to Animation component
public Animation anim;
public void Start () { ...
anim = transform.GetComponentInChildren<Animation>();
}
public void OnPathComplete (Path p) { ...
anim.Play("walk");
}
public void FixedUpdate () { ...
if (currentWaypoint >= path.vectorPath.Count) {
Debug.Log ("End Of Path Reached");
anim.Stop();
return;
...
}
}
}
Pathfinding: Examples in Unity
28
 We can do better than that!
 Turn when changing direction while moving
 Slow down before reaching destination
 Nicer/smoother paths
 Plan/replan for a moving target
 Plan/replan with a dynamic grid
Pathfinding: Examples in Unity
29
 We can do better than that!
 Astar AI4 script
 Target is a transform of an object in the game-world
 Repath rate
 Turning speed
 Slowdown distance
 Fancy code with coroutines and yield
(docs.unity3d.com:Coroutines-Yield)
Pathfinding: Examples in Unity
30
 We can do better than that!
 TargetMover script attached on main camera
 Moves target to position of mouse
 Always on or only when double click is detected
 Use the fuel cell as a target
 ObjectPlacer script attached on main camera
 Pressing “p” adds a game-object instance at ray collision
with a game-object in the scene
 Use it to place crates
 Pressing “r” removes game-object
Pathfinding: Examples in Unity
31
public class TargetMover : MonoBehaviour {
...
//Handle continuous move in Update() function
void Update () {
if (!onlyOnDoubleClick && cam != null) {
UpdateTargetPosition ();
}
}
public void UpdateTargetPosition () {
//Define a ray from eye to mouse position
Ray ray = cam.ScreenPointToRay (Input.mousePosition);
//Do raycast and if it hits the given mask layer
RaycastHit hit;
if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask)){
//transport the target at the hit position
target.position = hit.point;
}
}
Pathfinding: Examples in Unity
32
public class ObjectPlacer : MonoBehaviour {
...
void Update () {
if (Input.GetKeyDown ("p")) {
PlaceObject ();
}
if (Input.GetKeyDown ("r")) {
RemoveObject ();
}
public void PlaceObject () {
//Cast a ray, etc
...
}
public void RemoveObject () {
//Cast a ray, etc
...
}
}
Pathfinding: Examples in Unity
33
 Scripts
 Astar AI1
 Astar AI2
 Astar AI3
 Astar AI4
 TargetMover
 ObjectPlacer
 Either as originally from Aron’s Pathfinding Project or
with slight modifications
 Use the ones in the project in Pathfinding.zip
Pathfinding: Examples in Unity
34
 Many crates
Pathfinding: Examples in Unity
35
 Many crates – How does Lerpz know to avoid them?
Pathfinding: Examples in Unity
36
public void PlaceObject () {
Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition);
RaycastHit hit;
//If we hit an object
if ( Physics.Raycast (ray, out hit, Mathf.Infinity)) {
Vector3 p = hit.point;
//Instantiate a new game-object
GameObject obj = (GameObject)GameObject.Instantiate
(go,p,Quaternion.identity);
//Update the pathfinding graph
Bounds b = obj.collider.bounds;
GraphUpdateObject guo = new GraphUpdateObject(b);
AstarPath.active.UpdateGraphs (guo);
}
}
Pathfinding: Examples in Unity
37
 Local updates are faster if we have a huge map
 But can be problematic when objects end up farther
away or may fall on the ground later than the update
Pathfinding: Examples in Unity
38
 Many Lerpzs!
Pathfinding: Examples in Unity
39
 Many Lerpzs! FPS decreases even for just 10 NPCs
Pathfinding: Examples in Unity
40
 Grids can only go so far
Pathfinding: Examples in Unity
41
 Open scene “Pathfiding on platforms”
Pathfinding: Unity
42
 Height testing
 Similar to obstacles
 Use “Ground” layer to identify
areas that are walkable
 Raycasting
Pathfinding: Examples in Unity
43
 We can still tweak our grid to do the job
Pathfinding: Unity
44
 Or we can use a graph (Pointgraph, dist=4)
Pathfinding: Unity
45
 Or we can use a graph (Pointgraph, dist=4)
Pathfinding Part 3: Beyond the basics
46
 Many neat tricks for efficient/nice pathfinding
 Alternative game-world representations
 Beyond A*
 Better heuristics

More Related Content

What's hot

Unity 3D
Unity 3DUnity 3D
Unity 3Dgema123
 
Game Design Document - Step by Step Guide
Game Design Document - Step by Step GuideGame Design Document - Step by Step Guide
Game Design Document - Step by Step GuideDevBatch Inc.
 
[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study
[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study
[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study강 민우
 
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero DawnPlayer Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero DawnGuerrilla
 
Proposal of 3d GAME Final Year Project
Proposal of  3d GAME Final Year ProjectProposal of  3d GAME Final Year Project
Proposal of 3d GAME Final Year Projectfahim shahzad
 
Core Game Design (Game Architecture)
Core Game Design (Game Architecture)Core Game Design (Game Architecture)
Core Game Design (Game Architecture)Rajkumar Pawar
 
장재화, Replay system, NDC2011
장재화, Replay system, NDC2011장재화, Replay system, NDC2011
장재화, Replay system, NDC2011재화 장
 
Windows system - memory개념잡기
Windows system - memory개념잡기Windows system - memory개념잡기
Windows system - memory개념잡기ChangKyu Song
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine OverviewSharad Mitra
 
Igc2016 Technical Artist가 뭐하는 사람이에요?
Igc2016 Technical Artist가 뭐하는 사람이에요?Igc2016 Technical Artist가 뭐하는 사람이에요?
Igc2016 Technical Artist가 뭐하는 사람이에요?SangYun Yi
 
Indie Game Market Research Presentation
Indie Game Market Research PresentationIndie Game Market Research Presentation
Indie Game Market Research PresentationLogan Williams
 
Behavior Tree in Unreal engine 4
Behavior Tree in Unreal engine 4Behavior Tree in Unreal engine 4
Behavior Tree in Unreal engine 4Huey Park
 
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012devCAT Studio, NEXON
 
NFDC 2015 내러티브 중심의 디자인
NFDC 2015 내러티브 중심의 디자인NFDC 2015 내러티브 중심의 디자인
NFDC 2015 내러티브 중심의 디자인DongKyun Kim
 
[세미나] 특이점이 온다
[세미나] 특이점이 온다[세미나] 특이점이 온다
[세미나] 특이점이 온다Yongha Kim
 
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over WebsocketIntroduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocketsametmax
 
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdfNDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdfJongwon Kim
 
『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기
『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기
『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기복연 이
 

What's hot (20)

Unity 3D
Unity 3DUnity 3D
Unity 3D
 
Game Design Document - Step by Step Guide
Game Design Document - Step by Step GuideGame Design Document - Step by Step Guide
Game Design Document - Step by Step Guide
 
[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study
[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study
[IGC 2016] 띵소프트 이득규 - 삼국지조조전 Online L10N 개발 Case Study
 
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero DawnPlayer Traversal Mechanics in the Vast World of Horizon Zero Dawn
Player Traversal Mechanics in the Vast World of Horizon Zero Dawn
 
Proposal of 3d GAME Final Year Project
Proposal of  3d GAME Final Year ProjectProposal of  3d GAME Final Year Project
Proposal of 3d GAME Final Year Project
 
Core Game Design (Game Architecture)
Core Game Design (Game Architecture)Core Game Design (Game Architecture)
Core Game Design (Game Architecture)
 
장재화, Replay system, NDC2011
장재화, Replay system, NDC2011장재화, Replay system, NDC2011
장재화, Replay system, NDC2011
 
Windows system - memory개념잡기
Windows system - memory개념잡기Windows system - memory개념잡기
Windows system - memory개념잡기
 
Game Engine Overview
Game Engine OverviewGame Engine Overview
Game Engine Overview
 
Unity 3d Basics
Unity 3d BasicsUnity 3d Basics
Unity 3d Basics
 
Igc2016 Technical Artist가 뭐하는 사람이에요?
Igc2016 Technical Artist가 뭐하는 사람이에요?Igc2016 Technical Artist가 뭐하는 사람이에요?
Igc2016 Technical Artist가 뭐하는 사람이에요?
 
Indie Game Market Research Presentation
Indie Game Market Research PresentationIndie Game Market Research Presentation
Indie Game Market Research Presentation
 
Behavior Tree in Unreal engine 4
Behavior Tree in Unreal engine 4Behavior Tree in Unreal engine 4
Behavior Tree in Unreal engine 4
 
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
전형규, 가성비 좋은 렌더링 테크닉 10선, NDC2012
 
NFDC 2015 내러티브 중심의 디자인
NFDC 2015 내러티브 중심의 디자인NFDC 2015 내러티브 중심의 디자인
NFDC 2015 내러티브 중심의 디자인
 
[세미나] 특이점이 온다
[세미나] 특이점이 온다[세미나] 특이점이 온다
[세미나] 특이점이 온다
 
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over WebsocketIntroduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
Introduction to WAMP, a protocol enabling PUB/SUB and RPC over Websocket
 
Unity - Game Engine
Unity - Game EngineUnity - Game Engine
Unity - Game Engine
 
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdfNDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
NDC21_게임테스트자동화5년의기록_NCSOFT_김종원.pdf
 
『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기
『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기
『DirectX 12를 이용한 3D 게임 프로그래밍 입문』 - 맛보기
 

Viewers also liked

[0521 석재호]백트래킹알고리즘
[0521 석재호]백트래킹알고리즘[0521 석재호]백트래킹알고리즘
[0521 석재호]백트래킹알고리즘Jaeho Seok
 
Introductory Virtual Reality in Unity3d
Introductory Virtual Reality in Unity3dIntroductory Virtual Reality in Unity3d
Introductory Virtual Reality in Unity3dBond University
 
[1113 박민수]a star_알고리즘
[1113 박민수]a star_알고리즘[1113 박민수]a star_알고리즘
[1113 박민수]a star_알고리즘MoonLightMS
 
[0903 구경원] recast 네비메쉬
[0903 구경원] recast 네비메쉬[0903 구경원] recast 네비메쉬
[0903 구경원] recast 네비메쉬KyeongWon Koo
 
Mobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3DMobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3DMark Billinghurst
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmersNoam Gat
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsLinkedIn
 

Viewers also liked (11)

[0521 석재호]백트래킹알고리즘
[0521 석재호]백트래킹알고리즘[0521 석재호]백트래킹알고리즘
[0521 석재호]백트래킹알고리즘
 
Introductory Virtual Reality in Unity3d
Introductory Virtual Reality in Unity3dIntroductory Virtual Reality in Unity3d
Introductory Virtual Reality in Unity3d
 
[1113 박민수]a star_알고리즘
[1113 박민수]a star_알고리즘[1113 박민수]a star_알고리즘
[1113 박민수]a star_알고리즘
 
Unity 3d scripting tutorial
Unity 3d scripting tutorialUnity 3d scripting tutorial
Unity 3d scripting tutorial
 
[0903 구경원] recast 네비메쉬
[0903 구경원] recast 네비메쉬[0903 구경원] recast 네비메쉬
[0903 구경원] recast 네비메쉬
 
Unity 5 Overview
Unity 5 OverviewUnity 5 Overview
Unity 5 Overview
 
Mobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3DMobile AR Lecture6 - Introduction to Unity 3D
Mobile AR Lecture6 - Introduction to Unity 3D
 
Unity introduction for programmers
Unity introduction for programmersUnity introduction for programmers
Unity introduction for programmers
 
Unity3D Programming
Unity3D ProgrammingUnity3D Programming
Unity3D Programming
 
Unity presentation
Unity presentationUnity presentation
Unity presentation
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similar to Pathfinding - Part 2: Examples in Unity

【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップUnity Technologies Japan K.K.
 
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップUnite2017Tokyo
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfdbrienmhompsonkath75
 
Session 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdfSession 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdfEngmohammedAlzared
 
6.1.1一步一步学repast代码解释
6.1.1一步一步学repast代码解释6.1.1一步一步学repast代码解释
6.1.1一步一步学repast代码解释zhang shuren
 
Creating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdfCreating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdfShaiAlmog1
 
Java design patterns
Java design patternsJava design patterns
Java design patternsShawn Brito
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsNick Pruehs
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]Nilhcem
 
05 pig user defined functions (udfs)
05 pig user defined functions (udfs)05 pig user defined functions (udfs)
05 pig user defined functions (udfs)Subhas Kumar Ghosh
 
Reactive programming with tracker
Reactive programming with trackerReactive programming with tracker
Reactive programming with trackerDesignveloper
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptxGuy Komari
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Korhan Bircan
 
Actionscript 3 - Session 4 Core Concept
Actionscript 3 - Session 4 Core ConceptActionscript 3 - Session 4 Core Concept
Actionscript 3 - Session 4 Core ConceptOUM SAOKOSAL
 
Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced Flink Forward
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DRoman Protsyk
 

Similar to Pathfinding - Part 2: Examples in Unity (20)

【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
 
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
【Unite 2017 Tokyo】もっと気軽に、動的なコンテンツ配信を ~アセットバンドルの未来と開発ロードマップ
 
java question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdfjava question Fill the add statement areaProject is to wo.pdf
java question Fill the add statement areaProject is to wo.pdf
 
Unity3 d devfest-2014
Unity3 d devfest-2014Unity3 d devfest-2014
Unity3 d devfest-2014
 
Games 3 dl4-example
Games 3 dl4-exampleGames 3 dl4-example
Games 3 dl4-example
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Session 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdfSession 9 Android Web Services - Part 2.pdf
Session 9 Android Web Services - Part 2.pdf
 
6.1.1一步一步学repast代码解释
6.1.1一步一步学repast代码解释6.1.1一步一步学repast代码解释
6.1.1一步一步学repast代码解释
 
Creating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdfCreating an Uber Clone - Part XIX - Transcript.pdf
Creating an Uber Clone - Part XIX - Transcript.pdf
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
School For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine BasicsSchool For Games 2015 - Unity Engine Basics
School For Games 2015 - Unity Engine Basics
 
The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]The 2016 Android Developer Toolbox [MOBILIZATION]
The 2016 Android Developer Toolbox [MOBILIZATION]
 
05 pig user defined functions (udfs)
05 pig user defined functions (udfs)05 pig user defined functions (udfs)
05 pig user defined functions (udfs)
 
Reactive programming with tracker
Reactive programming with trackerReactive programming with tracker
Reactive programming with tracker
 
SAADATMAND_PYTHON
SAADATMAND_PYTHONSAADATMAND_PYTHON
SAADATMAND_PYTHON
 
golang_getting_started.pptx
golang_getting_started.pptxgolang_getting_started.pptx
golang_getting_started.pptx
 
Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)Useful Tools for Making Video Games - XNA (2008)
Useful Tools for Making Video Games - XNA (2008)
 
Actionscript 3 - Session 4 Core Concept
Actionscript 3 - Session 4 Core ConceptActionscript 3 - Session 4 Core Concept
Actionscript 3 - Session 4 Core Concept
 
Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced Apache Flink Training: DataStream API Part 2 Advanced
Apache Flink Training: DataStream API Part 2 Advanced
 
Augmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3DAugmented Reality With FlarToolkit and Papervision3D
Augmented Reality With FlarToolkit and Papervision3D
 

More from Stavros Vassos

Pathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basicsPathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basicsStavros Vassos
 
Pathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchPathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchStavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Stavros Vassos
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Stavros Vassos
 
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsThe SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsStavros Vassos
 

More from Stavros Vassos (12)

Pathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basicsPathfinding - Part 3: Beyond the basics
Pathfinding - Part 3: Beyond the basics
 
Pathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic searchPathfinding - Part 1: Α* heuristic search
Pathfinding - Part 1: Α* heuristic search
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture5-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture4-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
Intro to AI STRIPS Planning & Applications in Video-games Lecture3-Part1
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture2-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture1-Part2
 
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
Intro to AI STRIPS Planning & Applications in Video-games Lecture6-Part2
 
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCsThe SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
The SimpleFPS Planning Domain: A PDDL Benchmark for Proactive NPCs
 

Recently uploaded

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxPooja Bhuva
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptxMaritesTamaniVerdade
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17Celine George
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxUmeshTimilsina1
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 

Recently uploaded (20)

Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Pathfinding - Part 2: Examples in Unity

  • 1. INTERACTIVE OBJECTS IN GAMING APPLICATIONS Basic principles and practical scenarios in Unity June 2013Stavros Vassos Sapienza University of Rome, DIAG, Italy vassos@dis.uniroma1.it
  • 2. Interactive objects in games 2  Pathfinding  Part 1: A* heuristic search on a grid  Part 2: Examples in Unity  Part 3: Beyond the basics  Action-based decision making  AI Architectures
  • 4. Pathfinding: Examples in Unity 4  We will use a sample project in Pathfinding.zip  Based on  Aron Granberg A* Pathfinding project (free version)  http://arongranberg.com/astar/download  http://arongranberg.com/astar/docs/getstarted.php  3D Platformer Tutorial by Unity (free)  http://u3d.as/content/unity-technologies/3d-platformer- tutorial/  Unzip, open project, and load scene “Pathfinding on a plane” (it is already ready for experimentation)
  • 5. Pathfinding: Examples in Unity 5  We will use a sample project in Pathfinding.zip  Based on  Aron Granberg A* Pathfinding project (free version)  http://arongranberg.com/astar/download  http://arongranberg.com/astar/docs/getstarted.php  3D Platformer Tutorial by Unity (free)  http://u3d.as/content/unity-technologies/3d-platformer- tutorial/  Unzip, open project, and load scene “Pathfinding on a plane” (it is already ready for experimentation) Many other packages available, paid, free, or freemium. You can also write your own!
  • 6. Pathfinding: Examples in Unity 6  Creating the scene  Simple plane  Rigid body (docs.unity3d.com:Rigidbody)  Box collider (docs.unity3d.com:BoxCollider)  Checkerboard material  Crates  Rigid body  Box collider  Some material that looks nice
  • 7. Pathfinding: Examples in Unity 7  Creating the scene  Simple plane  Rigid body (docs.unity3d.com:Rigidbody)  Box collider (docs.unity3d.com:BoxCollider)  Checkerboard material  We want to note that this is the “ground” for navigation  Crates  Rigid body  Box collider  Some material that looks nice  We want to note that these are “obstacles” for navigation
  • 8. Pathfinding: Examples in Unity 8  Tags: mostly for finding game objects (docs.unity3d.com:Tags)  Layers: mostly for rendering purposes (docs.unity3d.com:Layers)
  • 9. Pathfinding: Examples in Unity 9  Here we specify two layers  Ground  Obstacles  And set the plane and crates to the correct one
  • 10. Pathfinding: Examples in Unity 10  Creating the scene  Adding a character that we will instruct to move around  Lerpz prefab from 3D Platformer Tutorial of Unity  Character controller component
  • 11. Pathfinding: Examples in Unity 11  Essentially a capsule-shaped Collider (docs.unity3d.com:CharacterController)  Can be told to move in some direction from a script  Can carry out the movement but be constrained by collisions (also step offset, slope limit)
  • 12. Pathfinding: Examples in Unity 12  Aron’s pathfinding package  Adding pathfinding functionality in the scene  Create empty object  Name it “A* Pathfinder”  Add the AstarPath script from Aron’s package  This is a unique central hub for computing paths  Adding pathfiding functionality to the character  Add the Seeker component
  • 13. Pathfinding: Ex. in Unity 13  Specify the parameters of the AstarPath script  Grid Graph  Position/size  4-connected/8-connected  Cut corners  Collision testing  Type/size of collider  Mask: Use Obstacle Layer  Scan and observe!
  • 14. Pathfinding: Ex. in Unity 14  Capsule collider with diameter 2  8-connected
  • 15. Pathfinding: Ex. in Unity 15  Capsule collider with diameter 2  8-connected “Cut corners” option affects these edges
  • 16. Pathfinding: Ex. in Unity 16  Capsule collider with diameter 6  4-connected
  • 17. Pathfinding: Examples in Unity 17  Using the Seeker script to get paths for Lerpz  Astar AI1  Astar AI2  Astar AI3  Astar AI4  Based on sample code in Aron’s pathfinding package
  • 18. Pathfinding: Examples in Unity 18  Using the Seeker script to get paths for Lerpz public class AstarAI1 : MonoBehaviour { public Vector3 targetPosition; public void Start () { //Get a reference to the Seeker component Seeker seeker = GetComponent<Seeker>(); //Start a new path to the targetPosition, //return the result to the OnPathComplete function seeker.StartPath (transform.position,targetPosition, OnPathComplete); } public void OnPathComplete (Path p) { Debug.Log ("Yey, we got a path back!"); } }
  • 19. Pathfinding: Examples in Unity 19  Astar A1 script calls the Seeker's StartPath function  The Seeker creates a new Path instance and sends it to the AstarPath script (in the A* Pathfinder game-object)  AstarPath script puts the path in a queue, when available, it processes the path by searching the grid in the A* heuristic search manner we described earlier  AstarPAth script calls the function OnPathComplete with the path it found as a parameter p  p.VectorPath holds a list of Vector3 objects that show how the destination can be reached
  • 20. Pathfinding: Examples in Unity 20  Seeker option to display path via gizmos
  • 21. Pathfinding: Examples in Unity 21  Post-processing path via modifiers (here: Funnell mod.)
  • 22. Pathfinding: Examples in Unity 22  Using Astar AI1 script, Lerpz is able to find out how to get to the target object (fuel cell prefab)  So, let’s make Lerpz move!  Accessing other components (docs.unity3d.com:Accessing)  SimpleMove function of Character component (docs.unity3d.com:CharacterController.SimpleMove)  FixedUpdate instead Update for physics-related things (docs.unity3d.com:FixedUpdate, unity3d.com/tutorials:Update-and-Fixedupdate)
  • 23. Pathfinding: Examples in Unity 23 public class AstarAI2 : MonoBehaviour { ... //The calculated path public Path path; //The character’s speed public float speed = 100; //The distance to a waypoint for moving to the next public float nextWaypointDistance = 3; //The waypoint we are currently moving towards private int currentWaypoint = 0; public void Start () { ... } public void OnPathComplete (Path p) { ... } public void FixedUpdate () { ... } }
  • 24. Pathfinding: Examples in Unity 24 public class AstarAI2 : MonoBehaviour { public void FixedUpdate () { //Check if we reached the destination if (currentWaypoint >= path.vectorPath.Count) { Debug.Log ("End Of Path Reached"); return; } //Direction to the next waypoint Vector3 dir = (path.vectorPath[currentWaypoint]- transform.position).normalized; dir *= speed * Time.fixedDeltaTime; controller.SimpleMove (dir); //Check if we need to switch to the next waypoint if (Vector3.Distance(transform.position, path.vectorPath[currentWaypoint]) < nextWaypointDistance) { currentWaypoint++; return; } }
  • 25. Pathfinding: Examples in Unity 25  Lerpz moves but without animating its parts  Basic animation of pre-defined clips  Animation component (docs.unity3d.com:Animation)  Play(“walk”), Stop()
  • 26. Pathfinding: Examples in Unity 26  Lerpz.fbx  Embedded animations that have been created outside of Unity for the 3D model  Available for  Playing  Looping  Blending
  • 27. Pathfinding: Examples in Unity 27 public class AstarAI3 : MonoBehaviour { ... //Cashed reference to Animation component public Animation anim; public void Start () { ... anim = transform.GetComponentInChildren<Animation>(); } public void OnPathComplete (Path p) { ... anim.Play("walk"); } public void FixedUpdate () { ... if (currentWaypoint >= path.vectorPath.Count) { Debug.Log ("End Of Path Reached"); anim.Stop(); return; ... } } }
  • 28. Pathfinding: Examples in Unity 28  We can do better than that!  Turn when changing direction while moving  Slow down before reaching destination  Nicer/smoother paths  Plan/replan for a moving target  Plan/replan with a dynamic grid
  • 29. Pathfinding: Examples in Unity 29  We can do better than that!  Astar AI4 script  Target is a transform of an object in the game-world  Repath rate  Turning speed  Slowdown distance  Fancy code with coroutines and yield (docs.unity3d.com:Coroutines-Yield)
  • 30. Pathfinding: Examples in Unity 30  We can do better than that!  TargetMover script attached on main camera  Moves target to position of mouse  Always on or only when double click is detected  Use the fuel cell as a target  ObjectPlacer script attached on main camera  Pressing “p” adds a game-object instance at ray collision with a game-object in the scene  Use it to place crates  Pressing “r” removes game-object
  • 31. Pathfinding: Examples in Unity 31 public class TargetMover : MonoBehaviour { ... //Handle continuous move in Update() function void Update () { if (!onlyOnDoubleClick && cam != null) { UpdateTargetPosition (); } } public void UpdateTargetPosition () { //Define a ray from eye to mouse position Ray ray = cam.ScreenPointToRay (Input.mousePosition); //Do raycast and if it hits the given mask layer RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity, mask)){ //transport the target at the hit position target.position = hit.point; } }
  • 32. Pathfinding: Examples in Unity 32 public class ObjectPlacer : MonoBehaviour { ... void Update () { if (Input.GetKeyDown ("p")) { PlaceObject (); } if (Input.GetKeyDown ("r")) { RemoveObject (); } public void PlaceObject () { //Cast a ray, etc ... } public void RemoveObject () { //Cast a ray, etc ... } }
  • 33. Pathfinding: Examples in Unity 33  Scripts  Astar AI1  Astar AI2  Astar AI3  Astar AI4  TargetMover  ObjectPlacer  Either as originally from Aron’s Pathfinding Project or with slight modifications  Use the ones in the project in Pathfinding.zip
  • 34. Pathfinding: Examples in Unity 34  Many crates
  • 35. Pathfinding: Examples in Unity 35  Many crates – How does Lerpz know to avoid them?
  • 36. Pathfinding: Examples in Unity 36 public void PlaceObject () { Ray ray = Camera.main.ScreenPointToRay (Input.mousePosition); RaycastHit hit; //If we hit an object if ( Physics.Raycast (ray, out hit, Mathf.Infinity)) { Vector3 p = hit.point; //Instantiate a new game-object GameObject obj = (GameObject)GameObject.Instantiate (go,p,Quaternion.identity); //Update the pathfinding graph Bounds b = obj.collider.bounds; GraphUpdateObject guo = new GraphUpdateObject(b); AstarPath.active.UpdateGraphs (guo); } }
  • 37. Pathfinding: Examples in Unity 37  Local updates are faster if we have a huge map  But can be problematic when objects end up farther away or may fall on the ground later than the update
  • 38. Pathfinding: Examples in Unity 38  Many Lerpzs!
  • 39. Pathfinding: Examples in Unity 39  Many Lerpzs! FPS decreases even for just 10 NPCs
  • 40. Pathfinding: Examples in Unity 40  Grids can only go so far
  • 41. Pathfinding: Examples in Unity 41  Open scene “Pathfiding on platforms”
  • 42. Pathfinding: Unity 42  Height testing  Similar to obstacles  Use “Ground” layer to identify areas that are walkable  Raycasting
  • 43. Pathfinding: Examples in Unity 43  We can still tweak our grid to do the job
  • 44. Pathfinding: Unity 44  Or we can use a graph (Pointgraph, dist=4)
  • 45. Pathfinding: Unity 45  Or we can use a graph (Pointgraph, dist=4)
  • 46. Pathfinding Part 3: Beyond the basics 46  Many neat tricks for efficient/nice pathfinding  Alternative game-world representations  Beyond A*  Better heuristics