Will giving explicit ownership to this function help? Doesn't seem to.
This commit is contained in:
parent
698f12d9bd
commit
65e7c0f870
|
@ -153,12 +153,12 @@ impl ComponentSetOption<ColliderPosition> for StaticColliderComponentsSet {
|
||||||
|
|
||||||
fn find_path_for_shape(
|
fn find_path_for_shape(
|
||||||
initiator: Entity,
|
initiator: Entity,
|
||||||
start: &dyn PointLike,
|
start: Coordinates,
|
||||||
destination: &dyn PointLike,
|
destination: Destination,
|
||||||
query_pipeline: &QueryPipeline,
|
query_pipeline: QueryPipeline,
|
||||||
map: &Map,
|
map: Map,
|
||||||
collider_set: StaticColliderComponentsSet,
|
collider_set: StaticColliderComponentsSet,
|
||||||
shape: &ColliderShape,
|
shape: ColliderShape,
|
||||||
) -> Option<Path> {
|
) -> Option<Path> {
|
||||||
let path = astar(
|
let path = astar(
|
||||||
&start.i32(),
|
&start.i32(),
|
||||||
|
@ -171,7 +171,7 @@ fn find_path_for_shape(
|
||||||
query_pipeline.intersections_with_shape(
|
query_pipeline.intersections_with_shape(
|
||||||
&collider_set,
|
&collider_set,
|
||||||
&shape_pos,
|
&shape_pos,
|
||||||
&**shape,
|
&*shape,
|
||||||
InteractionGroups::all(),
|
InteractionGroups::all(),
|
||||||
Some(&|v| v.entity() != initiator),
|
Some(&|v| v.entity() != initiator),
|
||||||
|_handle| {
|
|_handle| {
|
||||||
|
@ -186,7 +186,7 @@ fn find_path_for_shape(
|
||||||
}
|
}
|
||||||
successors
|
successors
|
||||||
},
|
},
|
||||||
|p| (p.distance_squared(destination) * 100.) as u32,
|
|p| (p.distance_squared(&destination) * 100.) as u32,
|
||||||
|p| *p == destination.i32(),
|
|p| *p == destination.i32(),
|
||||||
);
|
);
|
||||||
if let Some(path) = path {
|
if let Some(path) = path {
|
||||||
|
@ -229,12 +229,12 @@ fn calculate_path(
|
||||||
let task = pool.spawn(async move {
|
let task = pool.spawn(async move {
|
||||||
find_path_for_shape(
|
find_path_for_shape(
|
||||||
entity,
|
entity,
|
||||||
&coordinates_clone,
|
coordinates_clone,
|
||||||
&destination_clone,
|
destination_clone,
|
||||||
&query_pipeline_clone,
|
query_pipeline_clone,
|
||||||
&map_clone,
|
map_clone,
|
||||||
collider_set,
|
collider_set,
|
||||||
&shape_clone,
|
**shape_clone,
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
commands
|
commands
|
||||||
|
|
Loading…
Reference in New Issue
Block a user