NavMeshAgent Keyboard Movement | AI Series Part 34
Published: 21 Dec 2021
Learn how to move NavMeshAgents with the keyboard! No mouse required. Click-to-move is not the only way to move NavMeshAgents and have them respect the bounds of the NavMesh. Using this simple technique, you can easily move a NavMeshAgent on a NavMesh withg the keyboard!
This method does have some drawbacks:
1. NavMeshLinks are challenging to get working with this method
2. Cost Modifiers are also challenging to work with.
3. Obstacle Avoidance doesn't work (but Priority does!)
As usual with the AI Series, we're using the NavMesh Components: https://docs.unity3d.com/Manual/NavMesh-BuildingComponents.html not the built-in navigation system.
🔶 ALL THINGS LlamAcademy now available at: https://llamacademy.dev/support including latest tutorials, courses, ways to support, and more! Check it out 🙂
👨💻 Get the FULL FREE PROJECT on GitHub: https://github.com/llamacademy/ai-series-part-34
🏷️Save 25% on the ultimate C# IDE: JetBrains Rider with code LLAMACADEMY: https://www.jetbrains.com/store/?section=personal&billing=yearly
Some links may be affiliate links, which at no additional cost to you, gives me a small portion of the purchase.
Chapters
00:00 Introduction, Limitations, and What to Expect
2:20 Scene Overview & Input System Setup
03:49 PlayerInput.cs - Variables
04:47 PlayerInput.cs - Handling Input
06:55 PlayerInput.cs - Moving the Agent
09:18 PlayerInput.cs - Additional Smoothing Controls
09:50 Hooking it up in the Scene & Demo