AI on Sphere won't cross equator

I have a Sphere object, scale 100. We’ll call this “world”. On awake, I create a navmesh for it:

AstarPath.active.data.navmesh.sourceMesh = GetComponent<MeshFilter>().mesh;
AstarPath.active.data.navmesh.recalculateNormals = false;
AstarPath.active.Scan();

(I do this procedurally because I cannot for the life of me figure out how to tell Pathfinder to see the sphere’s mesh in the editor).

In this scene I have an RVOSimulator and a cube (“Agent”) with:

  • RVOController
  • Seeker
  • AIPathAlignedToSurface
  • AIDestinationSetter
  • FunnelModifier

I also have a small sphere (“Target”) on the skin of the World that is the target transform for AIDestinationSetter.

If the Agent and the Target both start in the same north/south hemisphere, Agent moves to target. But if either starts in a different North/South hemisphere, the Agent will move towards Target until it gets “near” the equator and stop, and kind of wiggle, and generate multiple paths over and over again. While playing if I go in the scene and move either Agent or target into the same hemisphere then the Agent moves to Target no problem.

This seems so basic to me that I am convinced I am doing something(s) wrong… but what?

Hi

What is your AIPath->constrain inside graph setting set to? Currently, the implementation for that doesn’t work great together with spherical navmeshes. It assumes all graphs have some well defined concept of “up”.

“Constrain Inside Graph” unchecked

Can you post a screenshot of the graph with A* Inspector → Settings → Graph Coloring set to “Areas”?

I’m using 4.3.47, do you mean Show Surface?

No I mean this setting

Hmm. Everything looks good as far as I can see…

I take it the spherical example scenes work?

Yes, perfectly! I’m quite envious.

What happens if you just switch out the mesh for the one in the example scene?

Same issue (that cube is Agent, the lower sphere is Target, and Agent is dancing about, trying to get closer to target).

Wait. That looks different. Now the graph has multiple different colors. What did you change?

I imported the Isosphere mesh from the example scene. Not right?

Any advice for how I may diagnose my issues?

Hmm. I can’t see anything that would cause it.

You are not by any chance using navmesh cutting?

No, I am not.

Let me bounce this off you; I am wondering if the normals for the triangles in that equitorial band as some how not “right,” but I lack the skill to determine this. Can you suggest a method I could use, in editor or in code, to investigate the normals?

Hi

If the path looks alright (enable Show Gizmos on the Seeker component, check that the green line crosses the equator) then the issue is with the movement script.

I can’t see anything on your movement script that would cause issues. But spherical worlds are not that well tested. Try to see if you can use the settings from the example scene.

1 Like