Search Unity

OpenPath: A simple, automatic A* implementation

Discussion in 'Assets and Asset Store' started by mrzapp, Nov 22, 2013.

  1. mrzapp

    mrzapp

    Joined:
    May 26, 2013
    Posts:
    137

    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


     
    Last edited: May 6, 2014
    SememeS likes this.
  2. V0odo0

    V0odo0

    Joined:
    Jan 8, 2012
    Posts:
    328
    C# must have! And thanks for share, I will test it soon.
     
  3. mrzapp

    mrzapp

    Joined:
    May 26, 2013
    Posts:
    137
    You can still use it with a C# project, just place the OpenPath folder in your Asset root directory :)

    EDIT: C# version is now available! Thanks landon91235
     
    Last edited: Nov 28, 2013
  4. dxcam1

    dxcam1

    Joined:
    Feb 6, 2012
    Posts:
    477
    Great work!
     
  5. mrzapp

    mrzapp

    Joined:
    May 26, 2013
    Posts:
    137
    Thanks! Let me know on this thread if you have any issues we need to fix
     
    Last edited: Nov 26, 2013
  6. jonatanbijl

    jonatanbijl

    Joined:
    Oct 7, 2013
    Posts:
    12
    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.
     
  7. jonatanbijl

    jonatanbijl

    Joined:
    Oct 7, 2013
    Posts:
    12
    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?
     

    Attached Files:

  8. mrzapp

    mrzapp

    Joined:
    May 26, 2013
    Posts:
    137
    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.
     
  9. MinSeni

    MinSeni

    Joined:
    May 18, 2014
    Posts:
    1
    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?:(

    Sorry for my english.
     
  10. HittmanA

    HittmanA

    Joined:
    Jul 27, 2016
    Posts:
    45
    Resurrecting dead post (hopefully)
     
  11. HittmanA

    HittmanA

    Joined:
    Jul 27, 2016
    Posts:
    45
    This project looks like it might be just what I need!