All Projects → RonenNess → Unity 2d Pathfinding

RonenNess / Unity 2d Pathfinding

Licence: mit
A very simple 2d tile-based pathfinding for unity, with penalty supported

Projects that are alternatives of or similar to Unity 2d Pathfinding

Ecs
ECS for Unity with full game state automatic rollbacks
Stars: ✭ 151 (+29.06%)
Mutual labels:  pathfinding, unity
Navmeshplus
Unity NavMesh 2D Pathfinding
Stars: ✭ 347 (+196.58%)
Mutual labels:  pathfinding, unity
Simple Optimized A Pathfinder
An simple and optimized grid pathfinding
Stars: ✭ 157 (+34.19%)
Mutual labels:  pathfinding, unity
09 Zombierunner Original
First person shooter with Unity terrain and AI pathfinding (http://gdev.tv/cudgithub)
Stars: ✭ 64 (-45.3%)
Mutual labels:  pathfinding, unity
Unity Script Collection
A maintained collection of useful & free unity scripts / library's / plugins and extensions
Stars: ✭ 3,640 (+3011.11%)
Mutual labels:  pathfinding, unity
Self Driving Vehicle
Simulation of self-driving vehicles in Unity. This is also an implementation of the Hybrid A* pathfinding algorithm which is useful if you are interested in pathfinding for vehicles.
Stars: ✭ 112 (-4.27%)
Mutual labels:  pathfinding, unity
Simple Firebase Unity
Firebase Realtime-Database's REST API Wrapper for Unity in C#
Stars: ✭ 111 (-5.13%)
Mutual labels:  unity
Holobot
HoloBot is a reusable 3D interface that allows HoloLens & VR users to interact with any bot using Mixed Reality & Speech.
Stars: ✭ 114 (-2.56%)
Mutual labels:  unity
Entitas 2d Roguelike
Rewrite of the Unity 2D Roguelike example using the Entitas Entity Component System
Stars: ✭ 110 (-5.98%)
Mutual labels:  unity
Cyanemu
CyanEmu is a VRChat client emulator in Unity. Includes a player controller with interact system. Works with SDK2 and SDK3.
Stars: ✭ 108 (-7.69%)
Mutual labels:  unity
Unityanimatorevents
UnityEvents triggered by states inside an Animator. Easy to use and performant.
Stars: ✭ 117 (+0%)
Mutual labels:  unity
Ma textureatlasser
Texture atlas creator for Unity
Stars: ✭ 116 (-0.85%)
Mutual labels:  unity
Proccharvfx
Procedural character generation with Unity Shader Graph and VFX Graph
Stars: ✭ 114 (-2.56%)
Mutual labels:  unity
Iframework
Simple Unity Framework
Stars: ✭ 110 (-5.98%)
Mutual labels:  unity
Cscore
cscore is a minimal-footprint library providing commonly used helpers & patterns for your C# projects. It can be used in both pure C# and Unity projects.
Stars: ✭ 115 (-1.71%)
Mutual labels:  unity
Unity
This repository contains all relevant information about Unity Container suit
Stars: ✭ 1,513 (+1193.16%)
Mutual labels:  unity
Unitydecompiled
Now unnecessary, use the official code instead: https://github.com/Unity-Technologies/UnityCsReference
Stars: ✭ 1,486 (+1170.09%)
Mutual labels:  unity
Pb stl
STL import/export for Unity, supporting both ASCII and Binary.
Stars: ✭ 108 (-7.69%)
Mutual labels:  unity
Otto
Otto sample project for the AI Planner
Stars: ✭ 113 (-3.42%)
Mutual labels:  unity
Unity3d Globe
Unity3D Implementation of Chrome Experiment WebGL Globe
Stars: ✭ 115 (-1.71%)
Mutual labels:  unity

Unity-2d-pathfinding

A very simple 2d tile-based pathfinding for unity, with tiles price supported.

NEW REPO

I moved this script to a dedicated repo for Unity utilities.

A newer version can be found here along with other useful Unity scripts.

This repo will remain online but won't be maintained.

About

This code is mostly based on the code from this tutorial, with the following modifications:

  • Removed all rendering and debug components.
  • Converted it into a script-only solution, that relay on grid input via code.
  • Separated into files, some docs.
  • A more simple straight-forward API.
  • Added support in tiles price, eg tiles that cost more to walk on.

But overall most of the credit belongs to Sebastian Lague, so show him your love.

How to use

First, copy the folder 'PathFinding' to anywhere you want your asset scripts folder. Once you have it use pathfinding like this:

// create the tiles map
float[,] tilesmap = new float[width, height];
// set values here....
// every float in the array represent the cost of passing the tile at that position.
// use 0.0f for blocking tiles.

// create a grid
PathFind.Grid grid = new PathFind.Grid(width, height, tilesmap);

// create source and target points
PathFind.Point _from = new PathFind.Point(1, 1);
PathFind.Point _to = new PathFind.Point(10, 10);

// get path
// path will either be a list of Points (x, y), or an empty list if no path is found.
List<PathFind.Point> path = PathFind.Pathfinding.FindPath(grid, _from, _to);

If you don't care about price of tiles (eg tiles can only be walkable or blocking), you can also pass a 2d array of booleans when creating the grid:

// create the tiles map
bool[,] tilesmap = new bool[width, height];
// set values here....
// true = walkable, false = blocking

// create a grid
PathFind.Grid grid = new PathFind.Grid(width, height, tilesmap);

// rest is the same..
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].