Say i have the following struct and resource:
#[derive(Component, Debug, Clone)]
pub struct TestStruct{
pub index: f32,
pub test_value: f32,
//other stuff
}
#[derive(Resource, Debug, Clone)]
pub struct StructContainer{
structs: Vec<TestStruct>,
}
and an update function:
fn set_shape_container(
mut structs_q: Query<&mut AABB>,
mut struct_holder: ResMut<StructContainer>,){
for (struct) in structs_q.iter_mut(){
struct_holder.structs.push(struct);
}
what i was hoping for is to iterate over the structs query in a way where the structs in the array will be sorted so that structs will be before other structs that have a higher index value (it can be changed to a u32 if required) then themselves, is this possible with queries?