I’m having issues with my pathfinding where the enemy (the one that has pathfinding enabled) is teleporting when near corners/edges. Its pathfinding position changes every frame to the player’s position. (my game is top down).
Can you post a screenshot of the movement events?
Usually, when a pathfinder object teleports it’s due to a conflict in multiple forces being applied like separate objects, another behavior or some other action. The pathfinder wants to follow its path. You can push it but on the next frame it will keep trying to get back onto the shortest path.
I have a “move patrol away from mapObjects” so it will not go through the map objects while also having its pathfinding updated every frame to the player’s position. It teleports weirdly around mapObjects.
alright so i fixed the weird teleportation for the most part by changing the order of the actions. Now I’m having a problem with it getting stuck at some obstacles. Even though it’s clearly a pathfinding obstacle it will try to still go through it. Here’s a video below.
https://drive.google.com/file/d/1aYHZ2uwQlm3vrZU74GjzGZ7eJKQYGOs6/view?usp=sharing
It’s best to add the pathfinder obstacle behavior to obstacles instead of using the separate objects action. I never tried using the separate before updating the path. It might work in certain situations. It would probably depend on the direction the object is moving in relationship to the obstacles.
The nav mesh pathfinder and it’s obstacle behavior works differently. I’ve never used it much but it might be worth a try if the official behavior doesn’t do what you want.
I’m using both the seperate and pathfinder obstacle to prevent the pathfinder from going inside objects while trying to make its way to the player.
It can be difficult to navigate tight spaces. It’s a matter of figuring out the best settings.
This works so well because the obstacles are the same size as the player
This wouldn’t work if the player was twice the size of the grid because the nodes between the obstacles won’t allow the player to find a path without the object being inside the wall.
This is what I used to draw the dots. It uses a shapepainter that doesn’t clear between frames and doesn’t use reference coordinates. It uses the variables X, Y, Total and Counter.
This might help you understand the issue. The key is there needs to be nodes that allow the object to completely fit without hitting an obstacle.
The behavior that draws the path helps. Along with using an event to give you feedback when a path isn’t found.
It’s tough because if the pathfinder grid is too small then it takes longer to calculate the path.
I fixed it sorta by playing with the cell size and points. thanks for the help