Support Forum

Bitmask. Is it possible to remove the mask from a bitmask?

Hello.
Thanks to your line of code, this is what I got. The game is slow because the gizmo is enabled.
https://youtu.be/u2UBE4Z_V3E

Characters remove tags from each other. I couldn’t think of a check to update the chart for characters that are worth to update the tag.

I want to try the following. Assign different tags to all characters, where I write the parameters. Assign and remove different tags from a node.
Here’s how I did it.

int tagMaskZone3=(1 << 3);
 var zone = new GraphUpdateObject(bigCollider.bounds);
  zone.setTag = tagMaskZone3;
  zone.modifyTag = true;
 AstarPath.active.UpdateGraphs(zone);

Will this code work? I need to add another tag to an existing set of tags.

zone.setTag =zone.setTag | tagMaskZone3;

And how to remove the “tagMaskZone3” tag from “zone.setTag”? The textbook says only how to reset everything.

And then how to remove all nodes with tags from the BFS “list” to which I assigned the tag?

The tags field is not a bitmask. It’s just a single tag.

1 Like

You may be interested in Utilities for turn-based games - A* Pathfinding Project

Yes, thanks to the code from the link above, I understand where the bitmask is used. The unity documentation says that only one tag can be applied to an object. I think the same goes for node. But the method described in the link does not suit me. It says how not to get where I don’t want to go. I have already learned how to do this, I create and remove obstacles in step-by-step mode or create a list of coordinates for real-time mode.
In addition, this method only works for one node, and my methods for many nodes. I’m trying to do the same as the original. There are no cells or anything like that, the movement is smooth. If there is a grid there, then it is small.
Now I’m trying to make the characters not stop in each other, but pass through each other. For several cases I did this, but recently I saw another one.
In the General, I will now try to assemble the nodes not through the collider, but through the list and make one more iteration.

https://youtu.be/le_fZVkszOI
I managed. Here is the code.

var  poziciya = AstarPath.active.GetNearest(transform.position, NNConstraint.None).node;
          var  areaa = PathUtilities.BFS(poziciya, 1).Where(node => node.Tag != KeshPriStart.tagMaskZone3).ToList();
            for (int i = 0; i < areaa.Count; i++)
            {
                areaa[i].Tag = (uint)KeshPriStart.tagMaskZone3;
            }