What about if I want to avoid collisions with some of the other agents? For example, in an RTS I have multiple friendly units using pathfinding and I don't want them to collide with each other when they move. I'm guessing adding both agent and obstacle nodes to an object isn't going to work, right?
Too bad generating navigation polygons in 2D is very clunky, you have to either do it manually through the editor, or "manually" do it through code. I'm surprised there's no simple one-button mesh baking like there is for the 3D mode, and I don't think there is a good reason for it
Hi, I downloaded the project and did some testing; the enemy doesn't seem to actually path around the obstacle. It just collides and slides off of it. Is there a way to make it actually path around it?
Yeah, I came to the same conclusion. If you take out all that physic and smoothing stuff and simply add the velocity from to the callback to the position, you see that the path finding completely ignores the obstacles.
@@NerdUndStolzDarauf From my understanding, NavigationObstacle doesn't do anything to change the agent pathfinding, it just modifies the velocity of the agent.
@@sergeantsapient Velocity is a vector that changes the direction and speed of the agent. What's strange to me is that the obstacle avoidance between agents is indeed effective. Before multiple agents collide, the velocity of the agent can be changed to achieve obstacle avoidance (this is actually the RVO algorithm. One disadvantage of it is that if the avoiding agent is pushed to a place without a navigation network, it will no longer be able to find the path normally). But what puzzles me is that the velocity does not change when the agent encounters an obstacle. I tried for a whole afternoon but couldn't find the answer. If anyone finds out what's going on, please let me know. Thank you!
Does this work for 3D ? every AI tutorial i find around about 3D is either only usable for single player mode only or is incredibly lag inducing when there are multiple AI agents.
Yes, you can play with several parameters: - Increase the radius of obstacles. If you want to keep a collision shape that fits the obstacle, then turn off the detect radius option on the obstacle node and set the radius manually. You may need to lower the agents' radius, so they don't struggle to fix between an obstacle and the navigation polygon's limits. - Increase the obstacle detection distance and the distance you can stray from the path on the agent. It'll try to avoid obstacles a little earlier (Path Max Distance). - If you use your own steering code for the agent's movement, I would recommend playing with the drag factor. Lowering it will make the agent accelerate slower but also turn slower and move in smoother and wider curves.
I did that in my project but my AI kept getting stuck on the objects while its chasing player that is on other side of the object it wants to avoid.. I expected more from this feature I even spent whole week trying to get it running... big disappointment for me. I ended up having to make AI going through objects which sucks but yeah well this engine can't deal with that reliably. Also there is no way to make AI avoid static obstacles that are created at runtime which is something that engine should be able to handle.. you have to draw empty spaces inside NavigationPolygon to where static objects are which is disaster as every time I add new object I have to complete re-do whole NavigationPolygon - which also makes it impossible to do randomly generated maps. I love godot but making games with AI is nightmare.