When I use the GetNearest method to find a position that can be moved, if two grids are connected locked, it will still pass through the intersection of the two grids.
Because the position returned by the GetNearest method is not the same as the distance from the unit position, I have length-scaled the returned position to ensure that the speed does not change when the obstacle is reached. So I feel the reason here, let the unit enter the locked area.
Well, just calling GetNearest will not do anything to validate that an agent could actually move between those two points.
I would recommend that you use the Linecast method instead.
See https://arongranberg.com/astar/docs/gridgraph.html#Linecast3
Hi,
I found that use Linecast can only on walkabke=false, So how does it work on the grid that uses Tag?
The second is how to use the method to move the unit on the edge of the obstacle. If the unit reaches the obstacle, I only find the GraphHitInfo.point. If the speed is 5, the distance from the start point to the hitPoint is 2, and the remaining 3, how? It can be moved according to the direction of the movement to continue the remaining distance on the edge 3
There is currently unfortunately no variant of Linecast that filters on a tag. You can get sort of the same information by using the overload that outputs all traversed nodes to the trace variable. (see https://arongranberg.com/astar/documentation/4_1_16_7f164ebc/gridgraph.html#Linecast4), and then check if any of those nodes contain that tag. Is there any reason you use tags and not walkability for this?