pub fn attach_bodies_and_colliders(world: &mut World) {
    let mut co_parents = Vec::new();
    'outer: for (collider_entity, co_pos) in world
        .query::<Without<
            ColliderParent,
            // Colliders.
            &ColliderPosition,
        >>()
        .iter()
    {
        // Find the closest ancestor (possibly the same entity) with a body
        let mut body_entity = collider_entity;
        loop {
            if world.get::<RigidBodyPosition>(body_entity).is_ok() {
                // Found it!
                break;
            } else if let Ok(parent_entity) = world.get::<Parent>(body_entity) {
                body_entity = **parent_entity;
            } else {
                continue 'outer;
            }
        }

        let co_parent = ColliderParent {
            pos_wrt_parent: co_pos.0,
            handle: body_entity.handle(),
        };
        co_parents.push((collider_entity, co_parent));
    }
    for (collider_entity, co_parent) in co_parents.drain(..) {
        world.insert_one(collider_entity, co_parent).unwrap();
    }
}
/// System responsible for creating a Rapier rigid-body and collider from their
/// builder resources.
System responsible for creating a Rapier rigid-body and collider from their
builder resources.
System responsible for creating a Rapier rigid - body and collider from their builder resources .
pub fn attach_bodies_and_colliders(world: &mut World) {
    let mut co_parents = Vec::new();
    'outer: for (collider_entity, co_pos) in world
        .query::<Without<
            ColliderParent,
            // Colliders.
            &ColliderPosition,
        >>()
        .iter()
    {
        // Find the closest ancestor (possibly the same entity) with a body
        let mut body_entity = collider_entity;
        loop {
            if world.get::<RigidBodyPosition>(body_entity).is_ok() {
                // Found it!
                break;
            } else if let Ok(parent_entity) = world.get::<Parent>(body_entity) {
                body_entity = **parent_entity;
            } else {
                continue 'outer;
            }
        }
        let co_parent = ColliderParent {
            pos_wrt_parent: co_pos.0,
            handle: body_entity.handle(),
        };
        co_parents.push((collider_entity, co_parent));
    }
    for (collider_entity, co_parent) in co_parents.drain(..) {
        world.insert_one(collider_entity, co_parent).unwrap();
    }
}
pub fn attach_bodies_and_colliders ( world : & mut World ) { let mut co_parents = Vec :: new ( ) ; ' outer : for ( collider_entity , co_pos ) in world . query :: < Without < ColliderParent , // Colliders. & ColliderPosition , > > ( ) . iter ( ) { // Find the closest ancestor (possibly the same entity) with a body let mut body_entity = collider_entity ; loop { if world . get :: < RigidBodyPosition > ( body_entity ) . is_ok ( ) { // Found it! break ; } else if let Ok ( parent_entity ) = world . get :: < Parent > ( body_entity ) { body_entity = * * parent_entity ; } else { continue ' outer ; } } let co_parent = ColliderParent { pos_wrt_parent : co_pos . 0 , handle : body_entity . handle ( ) , } ; co_parents . push ( ( collider_entity , co_parent ) ) ; } for ( collider_entity , co_parent ) in co_parents . drain ( .. ) { world . insert_one ( collider_entity , co_parent ) . unwrap ( ) ; } }
System responsible for creating a Rapier rigid-body and collider from their
builder resources.
System responsible for creating a Rapier rigid - body and collider from their builder resources .
world
&mut World
world
&mut World