Graphs and multilevel design

How do I make multiple floors traversable at the same time. It seems for level directly above one another, you can only scan effectively on one, not multiple.

Is this a bug, or is my configurations possible incorrect?

I am just curious if anyone else has tried this and succeeded.

Thanks in advance!


In the pro version you can use either the layered grid graph or the recast graph, both of which support multilayered environments.

1 Like

Thanks Aron, I tried to the layered graph today and it seems to be working like I hoped. However, I am noticing that once I transport an agent to a higher level they run into a argumentOutOfRangeException.

at the following line of code in PathInterpolator.cs

/** Move to the specified segment and move a fraction of the way to the next segment */
		public void MoveToSegment (int index, float fractionAlongSegment) {
			**if (index < 0 || index >= path.Count - 1) throw new System.ArgumentOutOfRangeException("index");**
			while (segmentIndex > index) PrevSegment();
			while (segmentIndex < index) NextSegment();
			distance = distanceToSegmentStart + Mathf.Clamp01(fractionAlongSegment) * currentSegmentLength;

What I do is turn off the AIPath script until I transport the agent and then turn it back on once they reach the second level. Is that the correct approach?

I am building this Elevator system which is why I am transporting rather than a system like stairs…

Thanks in advance!

Huh. That is odd. Do you happen to have the full stack trace for that exception?

That sounds reasonable. You might want to call the AIPath.Teleport function though, otherwise it might get confused by having moved such a large distance.

Thanks again Aron!
I am trying the teleport method now. Per your request, I wanted to share the stack trace as well below:

ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
Pathfinding.Util.PathInterpolator.MoveToSegment (Int32 index, Single fractionAlongSegment) (at Assets/AstarPathfindingProject/Core/Misc/PathInterpolator.cs:89)
Pathfinding.Util.PathInterpolator.MoveToLocallyClosestPoint (Vector3 point, Boolean allowForwards, Boolean allowBackwards) (at Assets/AstarPathfindingProject/Core/Misc/PathInterpolator.cs:139)
AIPath.MovementUpdate (Single deltaTime) (at Assets/AstarPathfindingProject/Core/AI/AIPath.cs:274)
Pathfinding.AIBase.FixedUpdate () (at Assets/AstarPathfindingProject/Core/AI/AIBase.cs:95)

There is one caveat to this… I have yet to update to the latest version which I will be doing today.

Thanks so much for looking into this Aron, I really appreciate it! I will be attempting the teleport method to avoid turning off the AIPath, that definitely sounds like it might resolve the issue itself.

Also, as my first time posting here, I want to thank you for making such a great asset. I rarely purchase assets, but this one is by far my favorite!

Thanks again!

Hmm… I cannot see a way for that to happen.
Let me know if it still happens after upgrading to the latest version.

Thank you for the kind words! :slight_smile:
If you feel like supporting the package even more, a review and/or a rating in the Unity Asset Store goes a long way :slight_smile:

Definitely! So far, the teleport function worked as expected. Thanks so much.

I have another question, but I will create a new post for that one to make it easier for others who might run into the above issue.

Thanks Aron!

1 Like