AI/Navmesh system limited to Characters only? Can't make Nav system talk to Pawn Input?

I’m somewhat stumped at the moment when it comes to adding AI to my project. I’ve created a custom Hovertank Pawn that does nothing more other than manipulate the Angular and Linear velocity of the craft, based on input. There’s some more complex math behind that of course, but that’s all working just fine. It has a custom movement component, but to be honest it doesn’t do anything fancy like prediction or non-physics based movement, it’s a barebones PawnMovementComponent with my code that updates the physics state of the craft. This is all done in C++ of course, and I rely on ReplicatedMovement and replication of the Input given to the craft for smooth network play, which has been sufficient so far.

The problem now is that I’m trying to set up AI for the vehicles, even something like simple movement (Move from point A to B etc). I’ve looked in as much detail as I can regarding the behaviour tree system and the default behaviours such as ‘Move To Actor’ etc, but they all interface somewhat VERY directly with Character Movement Component, just by giving it a vector direction to move in from what I can tell. There doesn’t seem to be any code that provides real ‘input’ to the pawn, which seems kind of hacked IMO and it limits how useable the navmesh system really is. Great for building a game based on humanoids where you can use all the existing code for that, but what about for different kinds of pawns like vehicles etc? Even the WheeledVehicles provided with the engine don’t seem to have any AI system at all - and I can’t get any vehicles to respond to Behaviour Trees at all.

I want to be able to use the NavMesh system (since, why bother writing my own pathing system right?), but it seems like the only way to do that is use this method of just giving the object velocity. That’s not going to work in my case since a lot of things depend on the input to the craft, like the material on the engines, the aiming of the craft etc. It also explains why AI characters don’t seem to pay any attention to the properties you give them when they are tweaked, according to this post.

In short, it feels like the Nav-mesh system is pretty much bound to characters that use CharacterMovementComponent, and that it has very limited use-ability in anything outside of that. Maybe I’m mistaken and need to go a bit deeper, but I’ve looked almost everywhere I can think of in Engine source and can’t find any pointers or clues as to where to start creating behaviours that interface with my pawn. If there ARE ways to do this, I would really like to hear them!

It looks like this is already in the roadmap under the AI category: Trello.

I agree it would be nice to be able to use the pathfinding system more generally.

OP:

Have you considered using Find Path to Location Synchronously | Unreal Engine Documentation

You are able to get path points from the NavMesh, and use them on any actor as you wish. You can pull Path Points (Vector Array) from the path between the two positions.

Is this what you’re looking for?

That’s certainly very useful to me, thanks! That at least allows me to make the engine create the path! I just need to find the C++ equivalent of this stuff now.

The difficult part for me now, is making the Pawn understand what it is supposed to do in relation to that path. Does it need to turn right or left, does it need to thrust, strafe or reverse etc. In the Character Movement Component, the pathing engine quite literally just gives it a vector direction to move in, and the movement component just “moves” the actor at the given speed. The rotation is handled automatically since it just rotates to face the direction it’s travelling in. In my case, the actor will have to turn itself and thrust itself to get there. That’s the part I’m struggling with, though I imagine I’d have to do that on my own regardless anyway.

@franktech - I want to avoid writing my own pathing code because I know that a) Epic’s version will probably be heaps more optimized than anything I could write right now, and b) because there could be several hundred of these actors in the world at once (and in Multiplayer). Calculating all that stuff on the fly for each actor will get expensive, especially if it’s trace/collision based. If I use the NavMesh system, I’m hoping I can reap the benefits of any optimizations made to it. (hence why I’m also doing all of this in C++, since speed is key for me.)

The final levels will be a mixture of Open-World-style levels with lots of Open Space, but there will also be buildings and general landscape-like features that they’ll have to Path around. More importantly, they’ll also have to path around each other, not just the world. (I’m fairly sure that NavMesh isn’t dynamic either right?)

It’s quite a complex topic really. If I can at least get the Behaviour Tree system to talk to the objects and get them to move between locations and look at objects as expected, I can make a start.

Is there a way to generate a path, gather data from it and then tell an NPC to follow that path instead of generating a new one from the same spot from scratch? I want to use path data to drive animations and don’t want to risk variances in path data causing animation issues if I generate 1 path for the anims and 1 for the character to follow, even if they are identical 99% of the time.