I am trying to implement AI for an RTS game with tanks. I have created basic tank pawns (without character movement component) and I am currently trying to get them to respond properly to a custom MoveTo command.
Currently, I am using the Find Path to Location Synchronously node to generate a list of points that should get a pawn to the specified destination. Then every tick, the tank pawns try to naively self navigate to each point along the path by simulating player input. The tank pawn is setup like this: Imgur: The magic of the Internet
The issue occurs when the path points are being recalculated in the NavigationPath object. When I try to access a point of the path using current point index the pawn is keeping while navigating, it gets stuck as the point it is heading towards keeps alternating between two positions, like so: - YouTube
Alternatively, I have tried to cache the point at the current index, and change it after it has been arrived at. Still the pawns exhibit some abberant behaviour: - YouTube . For some reason, the navigation path keeps slipping into an “invalid” state (as reported by it’s IsValid function - this is observable by “true” being printed in top-left - which is the output of the function), but only for a frame or too. This results in the jittery movement of the pawn.
I have also tried turning off recalculation of path, which yields reasonably satisfying results, but the pawns keep crashing into each other (since they are not aware of each other’s effect on the navmesh)
I have only just begun working with navmeshes and navigation, and the ability to generate a path around the world is critical for the game. Does anyone have any suggestions on how to fix this/improve this, or any alternatives to the problem? (I have tried using character movement on the tanks, let’s just say I won’t be going this way).
Thank you for your time.