playMaker

Author Topic: A* pathfinding (stable 0v841)  (Read 231343 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: A* pathfinding (stable 0v841)
« Reply #255 on: October 17, 2013, 12:38:37 PM »
ok, so what you need to do is you first of all need to move the Look at action below the move to action. Otherwise the direction is set to 0 on the first frame because it has not yet been calculated by the move to action at that point.

Then you need to create a new Vector3 variable. Let's call it Direction. Now have a look at the MoveTo action. At the bottom of that action, under Outputs, there should be a direction value. Click on the small icon right next to it to plug in your Direction variable. Now it will save the value of your current direction to that Variable, every frame, for as long as the moveTo action runs.

Now plug the direction variable in the Target Direction slot on the SmoothLookAtDirection action (again, press the small icon that looks like three horizontal bars to make it possible to choose a variable for this field).
In this case your Direction variable is used as an input.

Does it work now?

@LoneCypher
Thanks for understanding :)
Best,
Sven

mweyna

  • Full Member
  • ***
  • Posts: 242
Re: A* pathfinding (stable 0v841)
« Reply #256 on: October 18, 2013, 02:28:40 AM »
That works perfectly now. I feel like an idiot, i've been trying to solve this for weeks!

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #257 on: October 24, 2013, 11:51:23 AM »
Hey,

I am just looking at making a quick prototype with playmaker and the A* pathfinder. I have the pro version of the A* pathfinder and have imported it, and the latest version of playmaker, yet when I run the setup python file it tells me that the A* files are not there and asks if I want to install them, if I say no and go through the rest then everything seems to work ok, but then if I try to create a Recast Graph the path finder blows up when trying to draw the materials and setting passes for the shaders.

On the site (http://arongranberg.com/vanillaforums/discussion/381/error-cannot-build-recast-graph) it seems that the solution is to remove it and add it back in, but as this script moves it all around I am not sure if this is going to stop me from using the recast bit.

Is there no way of just manually installing the actions for the pathfinder as all Playmaker looks for is the classes with attributes indicating they are actions right? or is there some reason that the A* project has to get moved around etc?

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: A* pathfinding (stable 0v841)
« Reply #258 on: October 24, 2013, 12:28:38 PM »
there is a way to install it manually, but it is rather complex. Since it didn't recognize the A* plugin it means that this check :

Code: [Select]
if not(os.path.exists(papath + "/AstarPathfindingEditor") or os.path.exists(papath + "/Plugins/AstarPathfindingProject")(papath is the assets folder path)

...does not work on any of the newer versions anymore. I can't test it because my internet connection breaks down every few seconds and it cancels the download :S
Now, if the rest still works, then what you can do is delete the A* folder, reinstall the astar package, then run the installer again. It will move your stuff and even override if needed.
Best,
Sven

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #259 on: October 24, 2013, 12:53:25 PM »
No worries, you have done enough by making the plugin :)

Is there any technical reason why the folder structures have to move around?

As if I just bung in the actions and the wrappers manually to a folder like "AStarPlaymakerActions" (as that's all I can see that you *need*) it complains that it cannot find some namespaces, but I presume there is a way to locate the dependency?

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: A* pathfinding (stable 0v841)
« Reply #260 on: October 24, 2013, 01:11:33 PM »
When I started writing the plugin (which was quite some time ago), I was still in the process of learning .NET and Unity in general. While trying to make paths etc work inside PlayMaker I stumbled across a problem that was automatically fixed by using javascript instead of c#. So I switched to js. However, unity compiles the scripts in a very particular order.  Since this plugin needs many features from the original A* package, those scripts that contain these features need to be compiled before the scripts in this plugin are compiled, otherwise the compiler will not understand what for example a Path is.
For this reason the Astar package needs to be in the Plugin Folder, which will force-compile it before anything else. And that's what the installer does. The only fix for this is to convert the js scripts to c#, which considering how many scripts there are can take quite a bit of time. That is the reason why I never got motivated to doing it :|
Best,
Sven

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #261 on: October 24, 2013, 02:22:45 PM »
Is it just the FsmPathfinding folder that would need converting?

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: A* pathfinding (stable 0v841)
« Reply #262 on: October 24, 2013, 03:22:49 PM »
I believe so. I don't remember whether the dummy scripts for the free version were in js or cs, but they're so simple, it's only a matter of seconds to convert them anyways.
Best,
Sven

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #263 on: October 24, 2013, 03:38:47 PM »
I wouldn't say seconds... but shouldn't be a difficult task just mundane.

If I convert them over would you be able to test them? as I haven't got it working my side so although it may compile I wouldn't know if it was working as desired.

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: A* pathfinding (stable 0v841)
« Reply #264 on: October 24, 2013, 04:05:53 PM »
sure, but please don't underestimate the task ;) It would definitely be an important step forwards though :)
Best,
Sven

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #265 on: October 24, 2013, 04:31:43 PM »
I am about half way through, but I dislike monodevelop, my resharper licence ran out for VS2013 so will try to port over first then maybe refactor if it works, as there are a load of variable names which are not descriptive and static methods which could just be ported to extension methods to clean up the code base.

Would you be open to putting the project on github or something? then that way other people can contribute to it save you having to be the sole updater.

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #266 on: October 26, 2013, 04:56:43 AM »
Got a few issues with ComplexPointGraphFromChildren, but I think all files are converted, just need to work through the issues, but wont be online much this weekend so hopefully have it done soon.

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #267 on: October 27, 2013, 01:30:25 PM »
Right I have mapped it all over, its very dirty but compiles. There were a few bits of logic which seemed redundant... like it was setting a node and returning void, however in the JS version that was being captured as if it was returning the grid, so just made subsequent calls to get the grid. There were some other changes too but if you can give it a whirl and make sure it works or possibly fix the bits which are not 100%, then I will refactor and clean it up as ideally the enums and namespaces and variable names need tidying up.

I have attached an export to the post.

kiriri

  • Hero Member
  • *****
  • Posts: 506
Re: A* pathfinding (stable 0v841)
« Reply #268 on: October 27, 2013, 01:36:04 PM »
awesome, I'll test it asap, sorry for not replying on the weekend, I tried to find some time to get the git repo working, but it just wouldn't work and I couldn't really delve into the matter.
Best,
Sven

Grofit

  • Junior Playmaker
  • **
  • Posts: 73
Re: A* pathfinding (stable 0v841)
« Reply #269 on: October 27, 2013, 01:40:57 PM »
If you have set up github/bitbucket etc account then let me know the URL and I will branch and push up the latest version so you can merge it in if that helps.

If you haven't had time to set that bit up I can always set it up on my github account and then transfer ownership to you once you have time to sort it out?
« Last Edit: October 27, 2013, 01:44:18 PM by Grofit »