How to tag a node?

Hello there,

I am trying to set up a restricted area following the example 9. I have set up a node-based graph and added to GraphUpdateScene to one of the nodes. I tried with points and without. I then tagged the node as ClosedDoor.

In the player Seeker Component Closed Door is set as not traversable.

But my player traverses anyway and with debug coloring set to tags the node is not shown in a different color.

Does anybody have a solution?

On the screen it says “The list is empty”, 0 points. In the 9th example, nothing was dynamically created, everything needs to be done by hand. I think you have to mark the points yourself.
https://arongranberg.com/astar/docs/graphupdatescene.html

On the screen it says “The list is empty”, 0 points. In the 9th example, nothing was dynamically created, everything needs to be done by hand. I think you have to mark the points yourself.
GraphUpdateScene - A* Pathfinding Project

I tried that, but there was no change. ;(

But the screenshot shows what was done wrong. Dots need to be added. Draw a polygon or add point coordinates manually. The screenshot shows that the component is simply attached.

I tried with points and without.

It’s true, this screenshot shows only my try without points. If you don’t assign points the GraphUpdateScene states that it will use the bounds of the assigned collider instead, which I added to the node. But that also did not work.

Nevertheless - here is a screenshot with assigned points and as you can see the player still walks over the node.

Hi

Have you checked that the bounding box of the GraphUpdateScene component also overlaps the nodes along the Z axis? Your game looks like it is a 2D game, but the GraphUpdateScene component still works in 3D so the Z axis of the bounding box is also important.

Hi there.

It’s a 3D game with 2D Sprites. Yes I have checked the Z axis aswell. See the screenshots below:

I just now realized that you have a point graph, not a grid graph. I only worked with the grid graph. The last screenshot shows that the plane is perpendicular to the plane on which the spheres stand. In the grid graph example, the bounding plane is parallel to the navigation mesh. Only in a point graph, points can probably be located in different planes. I don’t know if this method is suitable for such a graph.

Your drawings are beautiful in the screenshots. Are your drawings available anywhere else?

Your drawings are beautiful in the screenshots. Are your drawings available anywhere else?

Thank you kindly. I have some work on Insta.

I only worked with the grid graph.

Are you sure? I tested the included DoorControl script and got it to work as intended. That script also changes the tag of the underlying graph to ClosedDoor.

Of course not.But if you need to change one point, then there is even a whole section on how to do it. Drawing six points to change a couple of points is probably not the best option.
But if you succeeded, then the issue is closed.

Bad social network, now only registered users can see something there. The old way doesn’t work anymore. Are there any other drawings of yours?

But if you need to change one point, then there is even a whole section on how to do it.

Could you reference it, please.

But if you succeeded, then the issue is closed.

Well, but I didn’t succeed exactly. I still don’t know how to change the walkability of a single point or if that is even possible. I’ve read somewhere that this is only a pro feature.

And then I would need a script to change the walkability of the node at runtime, so I open/close sections of the graph.

I had to use AIlerp since my game is projected vertically onto a wall, but that AI does not allow for collisions. So the only way to restrict its movement would be to change the walkability of the points.

I find the whole process very frustrating. But it seems without a good understanding of C# you reach the end of the line here very quick.

I read the documentation, but how do I know the rest of the code that is needed to execute a function like this for example Is there a documention for that, I can’t find?

// Recalculate all graphs
AstarPath.active.Scan();

Sorry for nagging. I know I should learn C#, but I’m a very visual person and I just don’t get coding.

Ok, I calmed down a bit :slightly_smiling_face: and bought the Pro Version and voila: it worked!

I can now restrict the AIs movement by using the GraphUpdateSzene component.

I will now try to hack and slash together a script that let’s me change the tag at runtime using the DoorController Script as an example.

1 Like

Buying the pro version is the right decision. This version has features that are not available to me, which save time and nerves. The library must be maintained.

From your screenshots it was clear, so I would like to see the rest of your work.

And without knowledge of C #, you can work with the library. I don’t know him well either. Initially, the topic was how to work with the GraphUpdateScene component, and not with one node. This is how I would do it with one node.

poziciya = AstarPath.active.GetNearest(transformPositionObstacle, NNConstraint.None).node;
poziciya.Tag=4;

This code works for me and I don’t even update the chart. I did not check this line, just type “.” and see what features are there.

poziciya.Walkable = false;

I don’t know what to do next. The cells are repainted but you can walk on them. I think we need to add a couple of lines of simple code there.

1 Like

Aaah, right. I forgot that updating point graphs is a pro-only feature. Sorry for not noticing that earlier.

@aron_granberg So the code I wrote above changes the tag and the passability in the point graph, without updating. I checked on the example that comes with the library. Or is there a pro version feature?
But in the grid chart, the tag changes, but the patency does not change without updating the chart. Is this true or have I done something wrong in my code?

Hi changing the tag or walkability of a note directly with a script is possible even in the free version. If you are updating a grid graph, make sure you also recalculate the nodes connections as described in the graph updates documentation.

This is not the question. If you do everything as written in the documentation, then everything turns out. But there are no examples of how to use the BFS function, I do almost everything through this function and I don’t see a drop in FPS.
In the grid graph. I can assign a tag to a node, and I can assign a blockage to a node. So there are no problems with the tag, everything works. But agents do not see obstruction. I suspect it is necessary to update the place where I assigned the obstruction.

What should be written after this line?

Do not need to write anything in the point graph. Everything works there.

https://youtu.be/dyI9d1ZcNZI

If you are using a grid graph, then

AstarPath.active.data.gridGraph.CalculateConnectionsForCellAndNeighbours((GridNodeBase)poziciya)

See Graph Updates during Runtime - A* Pathfinding Project

Does not work. In the function “CalculateConnectionsForCellAndNeighbors” you need to substitute the values “X” and “Z”. I tried doing this, it doesn’t work either.

bool zzz=false;
 void Update()
        {
            
            if (zzz==false)
            {
                zzz = true;
                var qwe = AstarPath.active.data.gridGraph;
                poziciyaTchk = AstarPath.active.GetNearest(transform.position, NNConstraint.None).node;
                areaaTchk = PathUtilities.BFS(poziciyaTchk, 2).Where(node => node.Tag != KeshPriStart.tagMaskZone3).ToList();
                
                    AstarPath.active.AddWorkItem(new AstarWorkItem(ctx =>
                    {
                        for (int i = 0; i < areaaTchk.Count; i++)
                        {
                            areaaTchk[i].Tag = (uint)KeshPriStart.tagMaskZone3;
                            areaaTchk[i].Walkable = false;
                            var d = areaaTchk[i] as GridNodeBase;
                            int index = d.NodeInGridIndex;
                            int x = index % qwe.width;
                            int z = index / qwe.width;
                        qwe.CalculateConnectionsForCellAndNeighbours(x, z);
                    }//  qwe.GetNodes(node => qwe.CalculateConnections((GridNodeBase)node));
                        
                    }));
                    

                
               
            }
}