Multiple views for disjoint components in a System
- Lingua principale
- Rust
- Stelle
- 1.7k
- Fork
- 140
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
Hi, I'm trying to integrate legion with nphysics. Right now what I have involves writing wrappers around legion's Query/SubWorld so nphysics can query for a specific Body, or run a function on every Body in the world.
let physics_system = SystemBuilder::new("physics")
.with_query(nphysics_legion::create_legion_body_set_write_query())
.with_query(nphysics_legion::create_legion_body_set_read_query())
.with_query(nphysics_legion::create_legion_collider_set_write_query())
.with_query(nphysics_legion::create_legion_collider_set_read_query())
.write_resource::()
.build(move |_, world, resource, queries| {
let mut bodies = nphysics_legion::SpecsBodySet::new(world, &queries.0, &queries.1);
let mut colliders =
nphysics_legion::SpecsColliderSet::new(world, &queries.2, &queries.3);
resource.step(&mut bodies, &mut colliders);
});
The problem with this is that nphysics expects the bodies and colliders (and other components) to be separate. The reason for this is given in https://github.com/rustsim/nphysics/issues/233#issuecomment-536926297, which I think is reasonable. But this causes lifetime issues since I have two wrappers both wanting the same `&mut SubWorld`.
Does it make sense for legion to have some sort of way to express disjoint "SubWorlds" in a query? Maybe somehow make it possible for `.build()` to have multiple SubWorlds?
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Valutazione
Questa issue non è ancora stata valutata.