Hey I love your pathfinding its amazing, however I am having as issue with the GraphUpdateScene component not working with my gridgraph… I’m getting confused with the options for it and the tutorial page I have tried using to trouble shoot my problem…
So I’ve made an empty gameobject, stuck a GraphUpdateScene on it and tried every thing I can think of but the gridgraph still won’t show the grid as being a ‘penalty’ (I want a penalty - not a total unwalkable area) the seeker on the gameobject just keeps pathing right on through the ‘penalty zone’, the tutorial is outdated? cause it shows options and settings that just aren’t there anymore… I’ll post some screen shots up if you want but I would super appreciate the tutorial updated or some kind of example of how I can get this to work!
my game is 2D and is setup on the X(side to side) - Y(top to bottom) axis with Z not being used being the back and forward ‘layer’ which I am not using since its just sprites and the layer order.
(my game involves NPCs walking around using the pathfinding and I’d like to make penalty zones so they avoid certain areas while routinely roaming from place to place)
Thanks in advance!
Hi
In the current version the GraphUpdateSceneComponent doesn’t work that well in the XY plane. I have improved this in my dev version and I think it might be in the latest beta (I am not quite sure though, check the changelog to be sure). You can use GraphUpdateObjects directly instead, see http://arongranberg.com/astar/docs/graph-updates.php
Awesome that did the trick! I used the script to modify tag, set the tag, modified the penalty of the seeker and graph and used a 3d collider on the update script I made with the method you linked. Cheers for the quick response! I’ll post a screenshot with the script I used for anyone else who has a similar issue with 2d / xy axis penaltys and tags
So to make the work around I did as the doc mentioned and added this script to the 3d collider object that intersects with the 2d gridgraph:
GraphUpdateObject guo = new GraphUpdateObject(GetComponent<Collider>().bounds);
//Made the GraphUpdate enable tagging
guo.modifyTag = true;
//This is an int so set the tag to the corresponding number in the list (you can modify the tags on the seeker script and call them whatever you want.
guo.setTag = 1;
//value of penalty applyed to the area the collider covers
guo.addPenalty = 85;
guo.updatePhysics = true;
AstarPath.active.UpdateGraphs(guo);
I used the penalty example with the bots that came with the pathfinding asset to make sure the settings of the gridgraph were correct (like setting the initial penalty) I’m still playing around with the settings to try and understand it a bit better but atleast its now working. Now the issue of making the colliders any shape will be the next hurdle as that would be a massive help and it doesn’t seem to work with 2d colliders.