Comments (4)
Hey! Just pinging to say thanks for opening the issue. I'm gonna see if I could investigate this sometime soon.
Main reason why the description warns people to not use the repository is because it currently has git hash dependencies still (and probably more bugs like this). I think it's not too far off a 0.1.0 release, however. At which point I'll probably remove that warning.
from nphysics-ecs-dumb.
I'm glad to hear back!
If it's any help, I tried two approaches to fix this in my toy app.
- Write my own Storage trait for types that are
Event + Clone
and have it send a clone of any value that gets removed as an event to its EventChannel. I ended up getting stuck trying to add subscribers to it in my System implementation... I think this change would have to be implemented inspecs
, but I could be wrong there... I still consider myself a Rust noob. - Set up a kind of reference loop between the Entity/Storage layer and the CollisionWorld.
- Have CollisionObjects in the CollisionWorld hold an
Option<Entity>
in theirdata
field, which is initiallyNone
. - A
Collider
component holds aCollisionObjectHandle
, which you get while constructing the CollisionObject. - Use
FlaggedStorage
for the Collider so we can see when new colliders are added/removed. - In the
SyncCollisionWorld
system, iterate the entity ids that were added to the collider storage. Follow theentity.id --> Entity --> Collider --> CollisionObjectHandle --> CollisionObject
chain of references to get a mutable reference to the new CollisionObject. Set itsOption<Entity>
toSome(entity)
. - Collect removed entity ids from the collider storage into a
BitSet
. Iterate over the CollisionObjects in the CollisionWorld. If that CollisionObject'sOption<Entity>
has anid()
that was in the BitSet, mark that object to be removed, and remove all of the marked objects after iterating.
- Have CollisionObjects in the CollisionWorld hold an
The second approach seems to work, but it feels dirty and somewhat unextensible. That said, it might solve the issue here, which is that there's currently no way to get back to the Entities for a collision. Nevermind, now that I poked around more in your source I think you already solved that.
from nphysics-ecs-dumb.
I put some more time in and figured out how to make my first approach work. I made a DetailedComponentEvent<E>
enum that's basically the same as ComponentEvent
but where the removal includes an E
value. Here's my implementation: https://github.com/dylemma/Falldown.rs/blob/master/src/storage/mod.rs
from nphysics-ecs-dumb.
The custom storage part is interesting to me. This problem of synchronization between libraries that force all data into World-like instances and an ECS application is truly frustrating and error prone. It feels like every line of code has a bit of interconnected state in it that's bound to blow up somehow that's completely impossible to test for.
from nphysics-ecs-dumb.
Related Issues (8)
- Implement specs-hierarchy based Multibody joints
- Explore design constraints necessary to allow many integration, timestep, etc designs HOT 1
- Implement time scale resource and simulation pausing
- Remove git dependencies
- Document all public types and functions
- Remove required Amethyst dependency
- Handle body activation
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nphysics-ecs-dumb.