fn move_system(pool: Res<ComputeTaskPool>, mut sprites: Query<(&mut Transform, &Velocity)>) {
    // Compute the new location of each sprite in parallel on the
    // ComputeTaskPool using batches of 32 sprites
    //
    // This example is only for demonstrative purposes.  Using a
    // ParallelIterator for an inexpensive operation like addition on only 128
    // elements will not typically be faster than just using a normal Iterator.
    // See the ParallelIterator documentation for more information on when
    // to use or not use ParallelIterator over a normal Iterator.
    sprites.par_for_each_mut(&pool, 32, |(mut transform, velocity)| {
        transform.translation += velocity.0.extend(0.0);
    });
}
// Move sprites according to their velocity
Move sprites according to their velocity
Move sprites according to their velocity
fn move_system(pool: Res<ComputeTaskPool>, mut sprites: Query<(&mut Transform, &Velocity)>) {
    // Compute the new location of each sprite in parallel on the
    // ComputeTaskPool using batches of 32 sprites
    //
    // This example is only for demonstrative purposes.  Using a
    // ParallelIterator for an inexpensive operation like addition on only 128
    // elements will not typically be faster than just using a normal Iterator.
    // See the ParallelIterator documentation for more information on when
    // to use or not use ParallelIterator over a normal Iterator.
    sprites.par_for_each_mut(&pool, 32, |(mut transform, velocity)| {
        transform.translation += velocity.0.extend(0.0);
    });
}
fn move_system ( pool : Res < ComputeTaskPool > , mut sprites : Query < ( & mut Transform , & Velocity ) > ) { // Compute the new location of each sprite in parallel on the // ComputeTaskPool using batches of 32 sprites // // This example is only for demonstrative purposes.  Using a // ParallelIterator for an inexpensive operation like addition on only 128 // elements will not typically be faster than just using a normal Iterator. // See the ParallelIterator documentation for more information on when // to use or not use ParallelIterator over a normal Iterator. sprites . par_for_each_mut ( & pool , 32 , | ( mut transform , velocity ) | { transform . translation += velocity . 0 . extend ( 0.0 ) ; } ) ; }
Move sprites according to their velocity
Move sprites according to their velocity
pool
Res<ComputeTaskPool>
sprites
Query<(&mut Transform, &Velocity)>
pool
Res<ComputeTaskPool>
sprites
Query<(&mut Transform, &Velocity)>