Hello! I’m trying to make units not be able to walk through eachother, basically having them be moving obstacles. Right now I’m using collision testing on an ‘Unwalkable’ layer and using a GridUpdater to update a Grid Graph. Here’s the wanted result (without collision testing):
Grid flickering is due to GridUpdater updating.
And here the actual result with collision testing:
I’m aware that the update radius is probably too low in this example, but that is not the problem.
Sometimes it is even worse, and it’ll move diagonally to the target all the way even though I only have four connections turned on.
Is there something that I’m missing? Or am I going at this the wrong way?
edit: It seems that collision testing removes the node, so the unit moves to a node before resuming its path, wether it is diagonal or not.
A character cannot navigate if you constantly mark its current location as being unwalkable. What you should do is mark the node with a tag. Each character will have its own tag which it marks the node which is below it with (make sure it is also removed when the character moves). Other characters seekers will be set up to only be able to walk on the default tag and its own tag, so they will see all other characters as unwalkable, but not itself.
Search the forum, there are a couple of posts about this approach.
Usually the better solution is to use local avoidance, however it looks like in your game all characters are pinned to fixed grid positions and that doesn’t work very well with local avoidance.
Sorry to ask again, I think I’ve prematurely set the thread to ‘answered’. Setting a character to have its own tag works, but I don’t want a seperate tag for each character as I intend to have multiple characters of the same type, possibly more than 31. I’ve searched around the forum and came across this thread: arongranberg.com/vanillaforums/discussion/comment/2652/ which seems to ask the same question.
Multiple solutions are mentioned here, such as increasing the amount of tags. I don’t think increasing the amount of tags is the way to go in this case, since you’d need to keep track of how many characters there are in the scene and end up with hundreds of tags. Ideally I’d like to keep the same tag for each character, while only ignoring its own.
Another one is setting the penalty. This appears to have the same problem as the first post, in that the character will still try to go to a different node before moving.
I don’t think that the problem is solved yet going by the other posts in that thread. Have there been any other takes on this since then? Counting out local avoidance due to the fixed grid.
If the characters will only occupy a single node, then the penalty approach will work.
Since every path will start at the same node, the penalty for the start node doesn’t really matter because all paths will traverse it anyway.
Ah, I thought the penalty approach didn’t work because I had forgot to set the tag as valid. Now the only remaining problem is that the characters will still move through eachother when there is no other way, and they can still move to eachother’s location.