Ensure pathfinding on gridless is possible by always generating a pathfinding point when a virtual wall is being inserted
This commit is contained in:
+14
-21
@@ -188,18 +188,13 @@ impl Pathfinder {
|
|||||||
if angle_diff <= PI {
|
if angle_diff <= PI {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
{
|
let angle_between = angle_diff / 2.0 + angle1;
|
||||||
let angle_between = angle_diff / 2.0 + angle1;
|
nodes.push(calc_pathfinding_node(
|
||||||
let pathfinding_node = calc_pathfinding_node(
|
point,
|
||||||
point,
|
angle_between,
|
||||||
angle_between,
|
distance_from_walls,
|
||||||
distance_from_walls,
|
&mut line_segments,
|
||||||
&mut line_segments,
|
));
|
||||||
);
|
|
||||||
if angle_diff > 1.5 * PI {
|
|
||||||
nodes.push(pathfinding_node);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
nodes.push(calc_pathfinding_node(
|
nodes.push(calc_pathfinding_node(
|
||||||
point,
|
point,
|
||||||
angle1 + 0.5 * PI,
|
angle1 + 0.5 * PI,
|
||||||
@@ -219,15 +214,13 @@ impl Pathfinder {
|
|||||||
if angle_diff <= PI {
|
if angle_diff <= PI {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if angle_diff > 1.5 * PI {
|
let angle_between = angle_diff / 2.0 + angle1;
|
||||||
let angle_between = angle_diff / 2.0 + angle1;
|
nodes.push(calc_pathfinding_node(
|
||||||
nodes.push(calc_pathfinding_node(
|
point,
|
||||||
point,
|
angle_between,
|
||||||
angle_between,
|
distance_from_walls,
|
||||||
distance_from_walls,
|
&mut line_segments,
|
||||||
&mut line_segments,
|
));
|
||||||
));
|
|
||||||
}
|
|
||||||
nodes.push(calc_pathfinding_node(
|
nodes.push(calc_pathfinding_node(
|
||||||
point,
|
point,
|
||||||
angle1 + 0.5 * PI,
|
angle1 + 0.5 * PI,
|
||||||
|
|||||||
Reference in New Issue
Block a user