GraphUpdateObject: "penalty" and "tag" in XY plane not working, need your help

Hi there!

I have the A* Pathfinding Project Pro (Unity asset), and need your help on the following.

I can’t get “Tag” and “Penalty” features to work in XY plane.

I am looking to add “Tag” and “Penalty” for specific object on runtime. Please see code at the bottom.

The code tries to add “Tag” and “Penalty” to an object named “Boundary” available in my scene.

I am expecting seeker to always select easiest path avoiding “Boundary” object in the path as it has highest penalty.

The attached code is working in XZ plane but it doesn’t work in XY plane.

FYI: I also tried using “Graph Update Scene” component to add “Penalty” area. It doesn’t appear in red color in XY plane while it appears in red color in XZ plane.

How can I make this work in XY plane?


GraphUpdateObject GUO = new GraphUpdateObject (GameObject.Find ("Boundary").GetComponent<BoxCollider> ().bounds);

GUO.updatePhysics = false;

GUO.updateErosion = true;

GUO.modifyTag = true;

GUO.setTag = 1;

GUO.addPenalty = 10000;

GUO.modifyWalkability = true;

GUO.setWalkability = true;

AstarPath.active.UpdateGraphs (GUO);

Hi

Do you think you could send me a small example project that shows this problem? I’m pretty sure graph updates work in the XY plane, and your code looks correct (except the bounds that might be incorrect).

Hi Aron,

Thanks for reviewing it. I have emailed you the sample project w.r.t this post.

Please review and let me know your thoughts.

Hello,

Could you share the answer once you get the response?

Thank you.

My earlier response:

I checked the scene and there are indeed some things that aren’t really well designed for the XY plane that I had forgot about.
The shape of the graph update scene component always checks the XZ plane even though more logically it should do a check in a plane parallel to the grid.

I will try to improve the functionality for 2D. Thanks for bringing this to my attention.
For now if you just use a GraphUpdateObject (not a GraphUpdateScene component) you can get it to work if you specify a bounds object that contains the nodes (on the Z axis as well!).

I have made some changes to the functionality of the GraphUpdateScene component which should enable it to be used in XY space (or any orientation). If you want I can send you a test version.

Absolutely, thank you for the fast response. My e-mail is (removed).

Hi Aron,

Thanks for making changes to the GraphUpdateScene component, sounds great!

Yes please, it would be great if you can send the test version.

Hi

I have sent a PM with a beta version to each of you. Hopefully with these new changes everything should work for you. I would also be interested to hear if you have any suggestions for how the workflow can be improved or if any interface details should be clarified or changed.

Hi Aron,

Many thanks for sharing the new changes!

I’ll try it out and let you know how it goes.

Hello everyone!

Sorry if I reopen the discussion, but I have the same issue with version 3.8.8.1, using “Update Scene Graph” or “GraphUpdateObject” (essentially the same code), nothing happens!

Did I do something wrong, or is not implemented yet in latest version?

Hi all,

I’m having some similar issues. Graph Update Scene does no recognize 2D colliders. I do attach a 2D collider (e.g. a Polygon Collider) and I still get the “no points and no collider o renderer attached…” warning.
I’m using latest (as of today) version: 3.8.8.1

It would be nice if that could be fixed

Hi

@Enric_Sesa
Good call. I have fixed this in my development version now. It will use the bounds of box2D and circle2D colliders and for polygon2D colliders it will use the polygon’s points for the shape.