News Forums RAIN General Discussion and Troubleshooting Custom Navigator for A* Pathfinding Project

Tagged: 

This topic contains 47 replies, has 13 voices, and was last updated by  mandi 1 month, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 48 total)
  • Author
    Posts
  • #14158

    spiaggefredde
    Participant

    Hello everyone!
    I’m trying to write a custom Navigator to support the A* Pathfinding Project plugin (http://arongranberg.com/astar) but I’m having some troubles, mostly because I can’t find some useful information about which methods have to be reimplemented and, in general, how does it work.
    The only hint I have found is a guy who developed a small project integrating the free version of the plugin (grid mesh, not navmesh) and a previous version of RAIN (first post from user yuewah, http://arongranberg.com/vanillaforums/discussion/820/integration-with-rainindie). Even refactoring his code I’m still having problems.
    Is there anyone who succeeded in integrating RAIN with A* Pathfinding Project? If so, can the code be shared, or at least post some hints or advices?

    #14171

    CodersExpo
    Participant

    I’m not exactly sure why you would want to do this. RAIN can generate navigation graphs and provide path finding out of the can. It’s also a highly customizable package. RAIN is not like some other “behavior” tree tool where you have to write a lot of code to get simple tasks done.

    I have two other behavior tree tools, which are great tools. However, with these tools I had to write all the scripting for the behaviors and FSM actions. I also had to integrate scripts I wrote to use Aron G. pathfinding because these other tools didn’t have navigation graph and pathfinding built in.

    If you have the pro edition of UNITY; then sure, you could use these other tools to integrate with UNIT’s navigation mesh and agent…but only IF you have pro. So….at the time I HAD to use Aron’s project, which is great btw, but takes some work to create all the scripts to tie it all together.

    I can’t tell you how it would be done with RAIN cause I haven’t found the need to do that. With the other behavior tools you have to implement their base classes and create your own custom class that works with the scripts you create for Aron’s project. It’s really quite a bit to explain everything but should be that hard to figure out once you get rolling.

    Anyway, good luck in whatever you decide. If you do figure out a way to this with RAIN I would be really interested in hearing how you managed to accomplish it. RAIN’s work flow is tightly coupled with the navigation manager so it might not be possible. Let’s see what Jester, Prime, Sigil and others say.

    #14178

    CodersExpo
    Participant

    I’ll do some research on this myself, cause I imagine using RAIN with UNITY’s built in navigation should be possible. If so, then it may be reasonable to assume we could use other custom graphs. I myself can see value in this and would like to know how that can be done. This is a great question and challenge 😉

    #14232

    spiaggefredde
    Participant

    I choose to use A* Pathfinding Project plugin for its flexibility and its expanded set of features, which are more useful in my project than Unity built-in navmash or even those of RAIN (obviously, only in the specific context of my project, other than that RAIN ones are extremely functional and useful). One of these features is the chance of specify at runtime penalty zones of navigation as polygons directly on the only plane/navmesh in the scene (in Unity’s built in navmesh, for example, you have to assign different layers to different meshes/planes at editor time).
    I really would like to write a custom navigator on my own, but the given documentation/API does not tell much about the call order of the methods provided by the navigator to initialize the graph or when you have to go from, let’s say, point A to point B (in my case, no waypoint patrol, just free navigation). It’s a pity, given the highly modular and customizable style of the whole framework.
    So, any advice is welcome 😛

    #14242

    CodersExpo
    Participant

    Here was a discussion I had with a forum member on how to dynamically create a navigation mesh. This may help get us started in this effort. I’m still planning to do some research and testing on this myself.

    http://rivaltheory.com/forums/topic/programatic-navmesh-generation-in-2-0-11/

    #25705

    Yuewah Chan
    Participant

    @spiaggefredde, https://dl.dropboxusercontent.com/u/9322397/RAIN/RAIN_Mecanim_AStar.zip
    It is an updated version of RAIN 2.0 + A* Pathfinding Project 3.4.x
    After open the project, you have to import A* Pathfinding Project by yourself and modify \AstarPathfindingProject\Core\AI\AIPath.cs , change private float lastRepath -> protected float lastRepath

    if you have any problem, feel free to ask me.

    #25709

    CodersExpo
    Participant

    Thank you Yuewah! I just downloaded the project and A*, made the code change and ran it. However, nothing happens. I did manually move the capsule and bear and they move beck to their original location. That is cool! I’ll have to read through what you did here. Very cool. ty

    #25770

    lordofduct
    Participant

    I plan to tackle this rather soon (as soon as I get some time to look through it, between my job and moving soon). As soon as I have it hammered out, I’ll share.

    I’m looking through Yuewah’s code, and it doesn’t seem complete, but it may give me a starting point.

    • This reply was modified 1 year, 2 months ago by  lordofduct.
    #25805

    Yuewah Chan
    Participant

    @CodersExpo, what is your problem actually, let me know if I can help?

    #25806

    Yuewah Chan
    Participant

    @lordofduct, why you say my code is not complete?

    #25814

    lordofduct
    Participant

    Because in your AStarNavigator class only one of the methods is actually implemented. The others just return generic results with out any testing.

    Example:

    
    		public override bool OnGraph(Vector3 aPosition, float aMaxYOffset = 0.0f){
    			return true;
    		}
    	    public override Vector3 ClosestPointOnGraph(Vector3 aPosition, float aMaxYOffset = 0.0f){
    			return aPosition;
    		}
    		public override bool IsAt(MoveLookTarget aPosition)
    		{
    			return true;
    		}
    	    public override MoveLookTarget GetNextPathPosition(bool allow3DMovement){
    			return new MoveLookTarget();
    		}

    ”edit - guess it doesn’t use bbcode on this forum…

    None of these methods do anything substantial.

    It probably works for basic work, but it doesn’t completely integrate on all aspects. This is probably enough for waypoint moving (not sure, haven’t fully tested it).

    I am unsure though as I haven’t dug completely into integrating the 2 together. Maybe there isn’t a lot that has to be done. Maybe these methods on RAINNavigator, though marked as abstract, aren’t yet used really, and don’t need proper implementations.

    But with the once over I’ve done, it doesn’t look complete.

    I do appreciate the work though. Thank you, hopefully it will be useful in helping me get what I need for my project, and I will certainly share my findings when done.

    • This reply was modified 1 year, 2 months ago by  lordofduct.
    • This reply was modified 1 year, 2 months ago by  lordofduct.
    • This reply was modified 1 year, 2 months ago by  lordofduct.
    • This reply was modified 1 year, 2 months ago by  lordofduct.
    #25832

    CodersExpo
    Participant

    Yuewah Chan

    I’m not sure there is a problem. I just wasn’t clear on what it was supposed to do. I ran the project and nothing happened. In scene view though I could drag there bear and when I let go he runs back to his start. That’s as far as I got. I still need to review it further but I have been tied up working on another project.

    This is all incredibly fascinating and of huge interest to me and others. If you have any other scene examples you like to share I for one would be appreciative. Thanks for your contribution to the community!

    #25910

    Yuewah Chan
    Participant

    @lordofduct, most of the functions in RainNavigator is used for RAIN’s NavMesh Path Finding. So it is not usable for AStar Path Finding, that’s why it is omitted in the AStarNavigator implementation.

    @CodersExpo, sorry, i think i miss something because i haven’t include the AstarPathfindingProject. And it has problem that if other try to import it by himself.

    • This reply was modified 1 year, 2 months ago by  Yuewah Chan.
    #25913

    Yuewah Chan
    Participant

    Just updated the example project. You can download again. Just open the “RAIN Move Example” scene and play. I have added the AstarPathfindingProject Free Version.

    #25945

    CodersExpo
    Participant

    Thank you very much Yuewah for your contributions! I do have the pro version of A*PFP and will give this a look. Thank you for taking the time to do this.

Viewing 15 posts - 1 through 15 (of 48 total)

You must be logged in to reply to this topic.