About Me 👈

DOTS Navigation with Auto-Jumping Agents and Movable Surfaces

Unity DOTS—ECS, Jobs, and Burst—integrated with NavMesh components. That's right, multi-threaded navigation.

unitycsharp

Created on January 25, 2020. Last updated on February 25, 2020.

Demo of my navigation agents jumping on moving surfaces.

The camera isn't moving. Impressed?

(Looking for my DOTS navigation user guide?)

Today, in my Unity demo repo on GitHub, I released my DOTS navigation code for both your convenience and mine. Why? Well, I needed a navigation solution that:

  1. Supports auto-jumping of agents between NavMeshSurfaces with artificial gravity relative to a shared normal.
  2. Allows surfaces to move together with agents on them via parent transform.
  3. Has a glorified parent, the so-called basis, that can be parented to another basis (and so on) to handle complex parent transform scenarios for surfaces and agents!
  4. Is multi-threaded. 👈
  5. Can be imported into other Unity projects.
  6. Includes multiple demo scenes in Assets/Scenes/Nav so I don't forget how it works.
  7. Is extensively documented even though I'll eventually get tired of updating the docs and then they will exist solely to confuse myself and others.
  8. Features toggleable agent-to-agent avoidance.
  9. And still provides good-old obstacle avoidance, only completing a "partial path" for agents who have a destination set inside an obstacle.

It's missing things, like tests (lol) and agent-to-agent avoidance (actually, there is agent-to-agent avoidance as of this commit!). Worse, all the parenting can cause a performance bottleneck if there are too many agents, but that will get worked out eventually was fixed. And if you were wondering, don't get uncontrollably angry, but I've been sitting on this for a while, and finally decided to let it into the wild. I just couldn't hide it any longer, despite lingering bugs and corner cases that need attention. After all, you'll submit some PRs instead of complain about stuff I made for free, right?

Of course you will...

Demo of my navigation agents jumping on moving surfaces.

Schucks, they jump and avoid obstacles? That's right, Timmy, but not without smoking non-filtered Chesterfield cigarettes to strengthen their lung muscles.

Be aware, the Unity folks are hard at work on an official DOTS navigation solution that will undoubtedly eclipse my unofficial one, hopefully sometime this year. At that point, I will immediately update or replace my navigation code, leaning on whatever they have in store for us. That said, in the meantime, we have my MacGyver'd code emotionally abusing the UnityEngine.Experimental.AI API to do things it was never intended for. Seriously, use my code at your own risk. I know I'm using it at my own risk.

Video of Michael McDonald playing Stuart on MADtv.

The talented Michael McDonald playing Stuart on MADtv. Comedy Central.

And this is not a tutorial, by the way. It's more of an announcement. "Look what I can do!" Too much will change with the code and demo scenes for me to justify maintaining parity with a monolithic tutorial or series. Keeping that in mind, all that went into getting this to even work will probably inspire some bite-sized tutorials.

So go check it out!