-
Notifications
You must be signed in to change notification settings - Fork 30
0.4.0 Rewrite #23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
0.4.0 Rewrite #23
Conversation
|
This latest commit is based on the work in dimforge/nphysics#237 (I cannot reference that git branch from my manifest due to the crates themselves being in subdirectories of the repository). This fixes compilation errors in the library, and now what's remaining is to clean up the API and get the examples running. |
|
The |
|
The nphysics PR has landed WOOT! Will remove the git submodules with the next nphysics release. |
|
Have you built with commit |
|
I was able to build after the following changes |
|
Apologies... I posted incomplete work because I was rushing out the door. Ignore the amethyst dep stuff, that's just me writing an example with the amethyst nalgebra bump. |
|
No worries, I was able to integrate the changes from this PR + my diff into my game project and it worked well! Overall, I was very happy with the cleaner API and the updated dependencies. There were a couple surprises when I found that 1) I needed to manually sync the |
Thanks for testing stuff out and posting feedback! I super appreciate it 💜 |
1e5b7bf to
815878e
Compare
|
I get an error when I try the build this branch error[E0495]: cannot infer an appropriate lifetime for lifetime parameter `'a` due to conflicting requirements
--> C:\Users\paris\.cargo\git\checkouts\specs-physics-8734272910d5c1dd\30331dc\src\systems\physics_stepper.rs:18:24
|
18 | impl<'a, N: RealField> System<'a> for PhysicsStepperSystem<N> {
| ^^^^^^^^^^
|
note: first, the lifetime cannot outlive the lifetime `'a` as defined on the impl at 18:6...
--> C:\Users\paris\.cargo\git\checkouts\specs-physics-8734272910d5c1dd\30331dc\src\systems\physics_stepper.rs:18:6
|
18 | impl<'a, N: RealField> System<'a> for PhysicsStepperSystem<N> {
| ^^
note: ...so that the types are compatible
--> C:\Users\paris\.cargo\git\checkouts\specs-physics-8734272910d5c1dd\30331dc\src\systems\physics_stepper.rs:18:24
|
18 | impl<'a, N: RealField> System<'a> for PhysicsStepperSystem<N> {
| ^^^^^^^^^^
= note: expected `shred::system::System<'a>`
found `shred::system::System<'_>`
= note: but, the lifetime must be valid for the static lifetime...
note: ...so that the type `nphysics2d::world::mechanical_world::MechanicalWorld<N, world::BodySet<'_, N>, specs::world::entity::Entity>` will meet its required lifetime bounds
--> C:\Users\paris\.cargo\git\checkouts\specs-physics-8734272910d5c1dd\30331dc\src\systems\physics_stepper.rs:19:5
|
19 | / type SystemData = (
20 | | Entities<'a>,
21 | | WriteExpect<'a, MechanicalWorldRes<'a, N>>,
22 | | WriteExpect<'a, GeometricalWorldRes<N>>,
... |
28 | | Write<'a, ProximityEvents>,
29 | | );
| |______^What am I doing wrong ? I'm using |
|
Use the following instead: - specs-physics = {git = "https://github.com/amethyst/specs-physics/", branch = "v0.4.0", default-features = false, features=["dim2"]}
+ specs-physics = {git = "https://github.com/distransient/specs-physics/", branch = "0.4.0", default-features = false, features=["dim2"]} |
|
I can't possibly review this, its way too big. What's the status on this? If its in working condition I'll port my project to it and see how that all works. |
|
Let me push real quick and I'll ping you on Discord. |
|
|
||
| #[cfg(all(feature = "amethyst", feature = "dim2"))] | ||
| impl Pose<f32> for amethyst::core::Transform { | ||
| fn sync(&mut self, pose: &Isometry<N>) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't compile with ["dim2", "amethyst"]. Changing this line to
| fn sync(&mut self, pose: &Isometry<N>) { | |
| fn sync(&mut self, pose: &Isometry<f32>) { |
seems to fix it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cies caught this in https://github.com/distransient/specs-physics/pull/3/files#diff-31c13a9ef9b71e024d9f383cc35f390a
That change will get merged soon
|
What's the status of this PR? By the looks of the description of the PR this seems almost finished? Would it make sense to start building towards your fork in the meantime @distransient? |
|
We need to complete this soon. :) |
31: Upgrade specs-physics to latest nphysics r=jojolepro a=willcrichton Since #23 seems to have stagnated, I went ahead and updated specs-physics to the latest nalgebra/nphysics versions. It passes all the tests in the repo, but I haven't attempted a larger integration into Amethyst yet. Co-authored-by: Will Crichton <wcrichto@cs.stanford.edu>
|
what is left to be done? |
|
What's left: resolve the conflicts with master + test & fix issues. |
Specs-physics 0.4 Rewrite
This rewrites the specs-physics API to remove unnecessary synchronization and copying by implementing the new BodySet and ColliderSet traits with Component Storages, indexing handles for each object type using Entity. This new API reduces maintenance burden, complexity, and better exposes the entirety of nphysics, all while likely improving performance.
Background
I originally planned to more directly integrate with the traits provided by nphysics (such as with concrete storages for different body types, that together implement the set traits, or even borrowing a custom rigidbody type and its associated position together to implement Body, eliminating the local position data and associated pose synchronization), reducing indirection and making access more simple, but this proved to be difficult, maybe impossible, to implement. And it didn't seem if such an approach was beneficial enough for its maintenance costs.
However, I came up with the idea of doing this the opposite direction with the join extension trait API, and found that it could be a very nice solution that would make the crate a lot easier to maintain. This led to me opening dimforge/nphysics#237 when I discovered that given the BodySet parameters were removed from some types, I could very simply implement BodySet (albeit using
Box<dyn Body>) and other associated Set types over Component Storages.Changes
BodySetandColliderSetimplemented as Storages, with object handles implemented using the Entity type.To Do
While the API itself is ready for use and review, I still have some of all of the following stuff to do:
However, the bulk of the work is done, especially the spooky (happy October) unsafe blocks in
handle.rs.One might say that the library definitely shouldn't be called nphysics-ecs-dumb any longer!