# Not understanding node positions

Hello. I’m trying to figure out something basic and it’s causing a lot of frustation.
I created a new 2D Grid Graph:

``````var node = AstarPath.active.GetNearest(transform.position).node;
print("Transform Position: " + transform.position);
print("Node Position: " + (Vector3)gn.position.Normal2D());
``````

Transform Position: (-0.6, 0.0, 0.0)
Node position: (0.0, 0.2, 0.5)

Why are there only y and z values? The object and grid are both zero on the z axis.

Here’s another example with the object moves farther to the left of the grid.

This makes absolutely no sense to me and I’m not sure what to even do.

Hi

It makes a lot less sense if you use the Normal2D method which returns a vector orthogonal (i.e. it is a normal) to the original vector (see https://arongranberg.com/astar/docs/int3.html#Normal2D). I’m not sure why you are using that.

Generally node positions are stored as Int3 coordinates which are exactly like Vector3 coordinates except that they are integers and all coordinates are multiplied by 1000 (Int3.Precisions) to be able to represent values down to millimeter precision.

You can cast between Vector3s and Int3s using the normal cast operator.

var i3 = (Int3)myVector3;
var v3 = (Vector3)i3;

1 Like

Oh, the humiliation. I’m not sure why either. My sleepy mind wasn’t thinking and just saw “2D” lol. Thanks.