Best Way to create a grid that fills the shape of a cube

Hi,

I am now investigating how to create a Grid Graph that will fill both the x,y,z of a cube. This is for 3D movement of objects in ‘outer space’.

I think that I have to use the Graph Generator (http://arongranberg.com/astar/docs/writing-graph-generators.php). However due to my lack of C# skills I am having a hard time working it out. I think I have the basic start sorted out, but I need some further guidance. Here is way I have so far:

`
import System.Collections.Generic;
import Pathfinding;
import Pathfinding.Serialization.JsonFx;

var aStar : AstarPath;
var customPointGraph = new PointGraph();

function Start()
{
aStar = GameObject.Find("_A*").GetComponent(AstarPath);
aStar.astarData.AddGraph(customPointGraph);
customPointGraph.Scan();
}

`

Is the method I mention the best way to achieve this?

Thanks!

Hi

Doing a 3D graph generator requires huge amounts of memory. I have done it before, but I had to slim it down a lot to be able to use it. And even then a 707070 grid was the maximum.

So this is something which is quite hard to code and might require a more specialized pathfinder to work efficiently. If you have a few number of nodes in the graph though you could do it with a point graph.
The easiest then would be to simply create a number of GameObjects at the desired coordinates and scan a point graph which finds all nodes within a small range.