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>(
mut commands: Commands,
pool: Res<AsyncComputeTaskPool>,
rapier_context: Res<RapierContext>,
obstructions: Query<&RapierColliderHandle, With<MapObstruction>>,
query: Query<
@ -157,6 +156,7 @@ fn calculate_path<D: 'static + Clone + Default + Send + Sync>(
}
}
let shape_clone = (*shape).clone();
let pool = AsyncComputeTaskPool::get();
let task = pool.spawn(async move {
find_path_for_shape(
handle_clone.0,