Hello, I’m currently using A* to create paths for a formation of men to follow, and I have the individual gameobject soldiers set their navmeshagent velocity in the direction of their desired destination, which is basically their place in the formation, where the formation itself translates along the ground with the position and rotation of the whole pathfinding unit, if that makes sense. The formations path is requested directly.
To show you visually, you can see the path corners and destination line debugged in yellow, and the individual entity desired destinations in red up rays, and the individual soldiers following to those red rays, in this picture below:
However, I don’t want to use the unity navmeshagent for the individual soldiers, as that requires having two navmeshes (unity and A*) and is not performant. Ideally, I would use something like AILerp to move them from their current to desired position. That in fact also works and is how I am doing it now, BUT, that means calculating a path every tick basically for every soldier as I am setting the destination on the AILerp component of each of those soldiers as the desired position moves away from them like this in the code:
e.astarPath.destination = desiredPosition;
instead of using the navmeshAgent more like this:
soldier._navMeshAgent.velocity = desiredPosition - soldier.GetPosition()
I think I’d like to set the velocity directly on the A* AILerp like on the Unity navmeshagent, basically so that the soldiers are still A* pathfinding ‘agents’, ie they move along the A* grid, not Unity navmesh, but just at a certain velocity without having individual paths, sort of like how you can do that with the unity navmeshagent velocity setting, but hopefully more performant (perhaps later even doing the transform changes in DOTS). Can A* be used like that? To make an object that just goes at whatever velocity while staying on the navmesh?
I take it I could do a custom movement script for this, basically like AILerp, but where the velocity is inputted? or no, lerp doesn’t really work like that? If the individual soldiers don’t have paths, but just follow a desired position that is an offset from that path, what would be the most performant way to move them? I could just lerp them manually to the desired position, but then they don’t conform with the navmesh.