Hi! Could you please help me configure pathfinding?
I need to change the smoothing max cell gap during the game.
When an object is moving to the first point, I need it to move in a straight line. For this, I need to set the smoothing max cell gap to 10. Then everything works well.
But when the object moves to the second point, I need the smoothing max cell gap to be set to 1. However, I can’t find this parameter. Maybe it doesn’t exist at all?
I’ve never had that issue or maybe I just didn’t notice it. IDK. It should take a straight line as long there isn’t any obstacles. I don’t see any actions to change the smoothing.
My tips would be if it makes sense for your project, try to align the objects to a grid and then set the virtual grid to the same value with an offset that’s half the size. This will center the points or nodes that the pathfinder behavior uses.
Everything just works smoother. It also helps to have the moving object slightly smaller. If the grid is 32 then maybe the moving object should be 30 or 28 maybe even smaller. Remember the pathfinder uses the bounding box not the collision mask. The moving object’s origin point should be in the center to keep it (well) centered.
It would help if you could provide more details on what you’re doing and maybe a screenshot of the movement events.
Are you adding points or objects to create multiple paths or are there hidden obstacles. Because it doesn’t look like the shortest path. I’m assuming it’s moving in stages.
Edit : There is a community pathfinder behavior called Nav Mesh. It uses its own obstacle behavior. It might work better for your project. I’ve used it. It’s good. Although, in one test project it wasn’t always taking the shortest path.
I placed the points exactly along the diagonal, and everything worked. The path became straight.
However, the thing is, I am making an isometric game. I wouldn’t want the object to move only at a 45-degree angle. Unfortunately, if the object moves at an angle of, say, 20 degrees, the path stops being straight.
What are you making? Have you tried the Nav Mesh behavior? There’s also a Linked Objects Tools behavior that works great with isometric but it depends on your needs. It moves based in a grid of objects. Although, it doesn’t have to be a grid but it dies grids nicely. There are example of the linked tools.
You can adjust the virtual grid’s X and Y separately. There’s bound to be a ratio or shared number. I’ve never had issues. Maybe set them to different values. You don’t want the grid size too small. The smaller the grid, the longer it takes to calculate the path. Although, it’s all relative to the size of the scene, the number of objects and the number of characters using the pathfinder.
Id I know a little more about what your project is I might be able to suggest a different approach or help you fine tune this one.