Multiple views for disjoint components in a System
- Ngôn ngữ chính
- Rust
- Star
- 1.7k
- Fork
- 140
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
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?
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.