Confused Seeker (finding path above)

I am using layeredgridgraph with multiple levels. When two levels are within a close enough range, the seeker script chooses the top level when pathfinding.

I would upload some images but I do not have the required permissions as a new user so I will attempt to describe.

I believe the astar settings are working as the pathfinding works going up and down stairs without issue. Obstacles are avoided. The settings on the character controller are:
slope limit: 45
step offset: 0.5
skin width: 0.08
min move distance: 0
center: x0 y0.4 z0
radius: 0.5
height: 0

Seeker script:
valid tags: ground
start end modifier:
priority: 1
exact start point: original
exact end point: original
use raycasting: true
mask: everything
use graph raycasting: true

in the debugger I can see the gameobject is
transform local position: (0.2, -7.8, 9.3)
AIPath.GetFeetPosition(): (0.2, -7.8, 9.3)
the path.vectorPath[0] is (0.2, -4.9, 9.3)

I put in the following code in an attempt to figure out what is going on:
var con2 = new PathNNConstraint();
con2.walkable = true;
con2.distanceXZ = true;
var f = AstarPath.active.GetNearest(currentPosition, con2);

The result was: (0.2, -2.4, 9.2)

Any pointers? How can I figure out what setting I have incorrect?

My guess is it is the astar height testing ray length. Can someone point me at a link to where this is explained in the documenation? I was not able to find the details about this.

No; I thought I had it but no go. This is still an issue.

The issue is the path that is determined is on the plane above the character and not the plane that the character’s feet are on. How do I influence this? The character’s height is 0. What else influences this?

Could this be related to the the aipathagent script? Does anyone have a reference to some documentation? I am trying to use this script to start the movement by setting its target. Is it not compatible with the layered grid graph?

I see the example scene uses a minebotai script.

Hi

Sorry for the late answer.

Hm, it’s hard to say what the problem is.
I have increased your accounts trust level, so you should now be able to post images. Do you think you could post one or two so that I can understand better?

Not sure if I found a bug or my configuration is not quite right so I hacked a bit to get my configuration to work.

In the LayerGridGraphGenerator.GetNearest(Vector3, NNconstraint, GraphNode) method, I found that when the node comparison was being performed to determine the nearest node, the node with the highest Y value was being selected.

I believe the transformation being applied to the node of where my creature is not equivalent to the levelgridnode position that it was being compared to. My solution was to compare the position of my creature with the clampedposition of the node to be compared.

I am sure there is a better way (efficient) but this seems to get the pathfinding to work. What are your thoughts?

var pos = inverseMatrix.MultiplyPoint3x4 (position);

		int x = Mathf.Clamp (Mathf.RoundToInt (pos.x-0.5F)  , 0, width-1);
		int z = Mathf.Clamp (Mathf.RoundToInt (pos.z-0.5F)  , 0, depth-1);
		
		int index = width*z+x;
		float minDist = float.PositiveInfinity;
		LevelGridNode minNode = null;
		for (int i=0;i<layerCount;i++) {
			LevelGridNode node = nodes[index + width*depth*i];
			if (node != null) {
                // JC - the node that was being determined to be closest was not the closest
                //      probably a more efficient way to determine this but if this works                   
                var n = new NNInfo(node);
                float dist = Vector3.SqrMagnitude(n.clampedPosition - position);
				//float dist =  ((Vector3)node.position - position).sqrMagnitude;
				if (dist < minDist) {
					minDist = dist;
					minNode = node;
				}
			}
		}

Hm… That’s odd. I don’t think that should be required.

Would it be possible for you to share a screenshot of where this setup works and the original one doesn’t?

Please see the original post for details of how the character controller is set. What other game object settings would be helpful?

I do have another issue though but I will post separately as to not confuse this thread.

Looked at the code again and now I see that my implementation was completely wrong.
I missed the line at the top which used the inverseMatrix to overwrite the position variable.

Why I have I not seen it before? Because this does not happen when the node size is close to 1 and the graph is positioned close to the origin. Which it of course was in my test cases.

I will include a fix in the next update.

Uploaded version 3.6.8.
You can download it here http://arongranberg.com/astar/download