OpenPath: A simple, automatic A* implementation

What is it?
It’s an automated, very simple path finding package for Unity. It’s based on A* and written in UnityScript and C#. I am doing this in tandem with our Deus Ex themed game The Vongott Chronicles.

C# version is maintained by:

landon91235

How to use it?
Refer to the sample project for a demonstration. You can select the map type in the “Scanner” object, and then activate the corresponding object (NavMeshTest, WayPointTest or GridTest).

If you want to enable multi-threading support, you need to get the Loom script by our lord and saviour whydoidoit, and uncomment the lines in OPPathFinder.js

WARNING!
For reasons unbeknownst to me, when you press “Play” and select an object with the OPPathFinder component on it, and the Unity Inspector is visible, there is a huge memory leak in Unity, causing the whole environment to come to a crawl. Select any other object in the scene (or unfocus/disable the inspector temporarily) and it’s fine.

Features

  • Automatic world bounds calculation
  • Raycast scanning and node placement
  • Easily adjustable scanning parameters
  • Multithreading support with Loom
  • Waypoint, grid and NavMesh based types
  • Free open source!

Future goals

  • A* algorithm optimisation (tough!)
  • Grid node calculation optimisation (tough!)
  • Baking in editor mode (easy!)
  • Custom inspectors (easy!)
  • Turning speed adjustable in inspector (easy!)
  • Local avoidance (tough!)

How to get it?
Get the latest package here
GitHub page here

Notes
While it has seen a fair few improvements since its conception, this plugin is not fully optimised. It will need some more work to compete with the fancy, overpriced frameworks on the asset store right now, but it can get there. I’d be very happy to have someone help me improve this and contribute more to the all too small open source development space in this community.

Screenshots



1 Like

C# must have! And thanks for share, I will test it soon.

You can still use it with a C# project, just place the OpenPath folder in your Asset root directory :slight_smile:

EDIT: C# version is now available! Thanks landon91235

Great work!

Thanks! Let me know on this thread if you have any issues we need to fix

I just unzipped the C# version in my unity 3.5 project (in a folder called OpenPath), and unity says
Assets/OpenPath/OPMap.cs(79,45): error CS1501: No overload for method FindObjectsOfType' takes 0’ arguments
and several similar messages. I replaced these occurrences with
GameObject.FindObjectsOfType(typeof(OPWayPoint)) as OPWayPoint[ ]
and the errors disappear.

Here’s my version of the C# scripts, works with 3.5 and 4

Thanks for creating this script.

Are there plans for incorporating curve radius in this? Or is that a too different topic?

1509563–85472–$OpenPath_CS.zip (7.46 KB)

There is already a C# version on the Github page, even though it’s not really needed, as it’s just a matter of where to place the scripts. There is a full explanation in the Unity docs about compile order. I will arrange this differently in a future version to make it easier.

Thank you for the algorithm. This is very useful.

But I have a little problem with using this algorithm.

Everytime I instantiate prefab including map object, scanner, and an pathfinding object having oppathfinder script in different four object’s(e.g obj1,obj2,obj3,obj4) script (obj 1~4’s scripts are same thing. only different thing is obj’s transform.), pathfinding only works when obj1 instantiates the prefab.

you guys have any idea about this problem?:frowning:

Sorry for my english.

Resurrecting dead post (hopefully)

This project looks like it might be just what I need!