April 24, 2018 at 21:33 #23129
I’ve noticed that my units sometimes escape the grid that they are on. When they do, they refuse to go back on the grid (they’ve tasted freedom, and they like it!). This happens if I get a unit to chase me to the edge of the grid. I’ve noticed that there is no way to make pathfinding more strict as to disallow this. https://imgur.com/nKCcyJ1
In the image, you can see that the dead space exists between the walkable and unwalkable areas. When the player jumps across this gap, enemies constantly fall off grid and down into the unwalkable grid area
April 25, 2018 at 11:00 #23138RamiKeymaster
- This topic was modified 3 weeks, 6 days ago by EmanTs.
Thanks for posting.
In Apex Steer there is a component called something like ‘Steer For Containment’, which will provide small forces to attempt to keep units on-grid.
Another option is to use invisible colliders at the edges of grids to keep units on them.
A third option is to adjust their movement capabilities on the speed component, such as the acceleration and deceleration, since units will typically fall off grid due to not being able to turn quickly enough or stop quickly enough.April 25, 2018 at 21:33 #23157
Steer For Containment did not suffice – it just made them fall down the cliff slower because they were trying to get back to their grid.
Invisible colliders are not really possible, as it would require way too much micro designing .
As for the speed component, we want enemies to instantly stop when they need to, so their deceleration is already at 9999999 (compared to an acceleration of 100) – that should be more than enough to stop[ before the end of the grid, no?April 27, 2018 at 19:33 #23166GeminiorKeymaster
To ensure that units stop on the spot, you also need to set the stopTimeFrame on the SteerableUnitComponent to 0.April 28, 2018 at 18:53 #23174GeminiorKeymaster
The path finder will never accept a position outside the grid, so unless the path is modified in a post processor to include such a position, the unit will never attempt to move off grid.
If given a position right on the edge, it can theoretically happen that it overshoots, but since you have the unit set to stop instantly, the only way it could happen that I can think of, is if the arrival threshold is set too low.
I kinda doubt that is the cause though and I am fresh out of other ideas.April 30, 2018 at 21:54 #23180
Solved: Essentially, what was happening was that the enemy was calling unitfacade.moveto the player every frame. If the move is not possible, the unit facade doesn’t care at the moment – it is a frame later that a stop is signaled. I needed to use some delay >0 for recalculating the path and it is good now
You must be logged in to reply to this topic.