When querying from a set of entities with the Forces QueryData, the user is unable to call any read-only functions defined on ForcesItem, e.g.
fn get_total_inertia(objects: Query<(Forces, &Mass)>) {
let total = objects
.iter()
.map(|(forces, mass)| forces.linear_velocity() * mass.0)
.reduce(|a, b| a + b);
}
returns the compilation error:
no method named linear_velocity found for struct forces::query_data::ForcesReadOnlyItem<'__w, '__s> in the current scope
A straightforward approach would be to implement each of the read-only functions from ForcesItem on ForcesReadOnlyItem here, that would return the same results as a ForcesItem. This would allow read-only access to Forces methods, freeing up time needed to mutably retrieve the components