Generating a XY GridGraph

Hi,

Thanks for your work on this project Aaron. I’m hoping it will save me a lot of time!

I require a GridGraph, generated on the XY plane. I’ve searched and can see people asking if you support this but it’s a bit vague whether or not you do or not in the current version. I’ve seen posts from people that link to full or partial solutions but none of the links are valid anymore.

Does your project support this out of the box? If not, what is the best way for me to customize your code? (I don’t care about movement, I just want to generate a graph that your A* module can use to give me a path)

Thanks for any help

Hi

Grid graphs on the XY plane is no problem. Just rotate the graph (there is a rotation field in the inspector).
2D physics is also fully supported (just a toggle in the inspector).

It’s the movement scripts for moving along the generated paths that are not fully supported yet (though if you search, there are a couple of 2D scripts I have posted on the forum (see Simple example script for a 2d top down character (y up axis)?) which can be used).

Blimey! That was quick! Brilliant. Many thanks Aaron.

1 Like

okay, I’ve add a rotated gridgraph (around the x-axis) to the scene but when I click scan I get a very strange looking graph indeed. The links are only along the horizontal and they are warped into the z-axis. Also, there are plenty of areas where there are no obstacles but no edges have been created.
I’ve attached images in both planes so you can see.Any idea what’s happening?
.

Hi

Check the climb axis. There should be a big warning box in the inspector if you have a recent version.
It looks like the raycast is hitting some large sphere colliders that you have in your scene. Check the height testing layer mask. Or maybe you want to turn off height testing and enable 2D physics?

Hi Aaron, thanks again for your prompt answer. I’ve turned off height testing and that’s got me part way there. I reckon I know what’s going on with the rest of it and feel confident I’ll be able to fix.

1 Like