Question about overlap of 2 GraphUpdateScenes

I use 2 GraphUpdateScenes to create 2 areas and there is an overlap area between them. (Please see below figure) . Then I put 2 characters in A and B. But character in area B always can’t move to overlap area (he only can move in area B), only character in area A could move to overlap area. But once the character in area A moves to C, it couldn’t move out of C, it will always move in area C.

I would like to know how to make my character (in area A) could move on A & C, character (in area B) could move on B &C ?

Thanks.

There is no real support for it. However you can cheat a bit to get the desired behaviour.
Since there are 32 possible tag values on each node, we can use that as a bitmask and store 5 different tags (one for each bit, 2^5 = 32). So each node could contain up to 5 tags at once.
So you can do

node.Tag = 1 << 1 | 1 << 4; // Use tag 1 and 4
node.Tag = node.Tag | 1 << 0; // Now it also has tag 0

See https://en.wikipedia.org/wiki/Mask_(computing)

You will however have to modify the GraphUpdateScene class in order to apply these tags (it would need to use OR instead of simply setting the field).

When setting the tag mask on the Seeker, you need to think of the values as bitmasks, so if you in the seeker inspector say that “tag 5 can be traversed”, that really means that a node which has exactly tag 0 and 2 can be traversed (since 2^0 + 2^2 = 1 << 0 | 1 << 2 = 5).

I hope this will help you.

Thanks a lot. It’s helpful suggestion.
I have an idea and it seems work.
I add an additional variable in GraphNode to store multiple tags (use bit mask, like your suggestion).

void Apply (GraphNode node) {
...
      node.multiTags |= (uint)(1 << setTag);
}

Then I check this variable with current tag (using & operator) when calling API: CanTraverse() and Suitable().
Now my characters could move on its own area, include overlap area.
It looks good now, but I’m not sure if there is any side effect ?

1 Like

Hi

I think that should work perfectly.
Only potential caveat is that this data will not be stored if you want to serialize the data to a file (if you are just using it during runtime, this will not be a problem).