Refactor access of AsyncComputeTaskPool.

This commit is contained in:
Nolan Darilek 2022-08-01 12:30:37 -05:00
parent 2ff8a858ed
commit 5f14a90b92

View File

@ -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,