I’m trying to make work on tile based movement still, but I’m having a hard time figuring out a few things, and so I was hoping someone might be able to help me.
Here’s how the pathfinding I’ve set up works right now.
I’d like to have nodes be able to connect so that pathfinding would work like this though:
How do I go on about doing that, is it even possible? Thanks in advance.
Err… So the graphs should ONLY allow diagonals in between diagonal obstacles.
Sure, that is possible (it’s just basically the opposite of what people usually want).
You will need to modify some code however. Take a look at the GridGraph.CalculateConnections method. That method calculates how nodes connect to other nodes.
I struggled to find a lot of information about the method and to figure out how it works, but I think I have a vague idea of how it would work now. I’m still a newbie coder and I have a lot to learn so if I need to modify the code in the way I assume I’ll have to it’s too advanced for me (right now).
I might be wrong though and I might be missing something, it’s possible that it’s easier than I think. Feel free to throw in some example on how I can use the method or where I can learn more about it and I’ll be the happiest person alive this day.
Don’t worry, I don’t expect you to code this for me, it’s my own fault for experimenting with things way above my level. It’s interesting though, can’t help myself.
Otherwise it will try to create connections to nodes that don’t exist.
You can see the comment in the code a few lines above: //We don't need to check if it is out of bounds because if both of the other neighbours are inside the bounds this one must be too
the changes we made previously invalidated that assumption.