Refactor access of AsyncComputeTaskPool
.
This commit is contained in:
parent
2ff8a858ed
commit
5f14a90b92
|
@ -110,7 +110,6 @@ fn find_path_for_shape<D: 'static + Clone + Default + Send + Sync>(
|
||||||
|
|
||||||
fn calculate_path<D: 'static + Clone + Default + Send + Sync>(
|
fn calculate_path<D: 'static + Clone + Default + Send + Sync>(
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
pool: Res<AsyncComputeTaskPool>,
|
|
||||||
rapier_context: Res<RapierContext>,
|
rapier_context: Res<RapierContext>,
|
||||||
obstructions: Query<&RapierColliderHandle, With<MapObstruction>>,
|
obstructions: Query<&RapierColliderHandle, With<MapObstruction>>,
|
||||||
query: Query<
|
query: Query<
|
||||||
|
@ -157,6 +156,7 @@ fn calculate_path<D: 'static + Clone + Default + Send + Sync>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let shape_clone = (*shape).clone();
|
let shape_clone = (*shape).clone();
|
||||||
|
let pool = AsyncComputeTaskPool::get();
|
||||||
let task = pool.spawn(async move {
|
let task = pool.spawn(async move {
|
||||||
find_path_for_shape(
|
find_path_for_shape(
|
||||||
handle_clone.0,
|
handle_clone.0,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user