Testbed and specs.rs, how to influence physics world?


I want to create a 2d game server, using nphysics and specs.rs behind the scene.

While both seems compatible, I have trouble with rapid prototyping : I’d like to use testbed to avoid recoding the renderer engine.

I built this minimal repository to explain my issue : https://github.com/Vrixyz/testbed-callback

Thank you for your answers, I created an issue on my repository so I track it easily : https://github.com/Vrixyz/testbed-callback/issues/1


I did not anticipate the testbed being used that way. Both specs and the testbed have quite strong ownership requirements here. I guess we will have to think of a way to modify the testbed so it does not have to own the physics world.

Or perhaps the rendering part of the testbed should be more clearly separated from the code that handles the physics world. That way you could just start the renderer alone, and synchronize the position of the rendered objects with the physics objects manually at each frame.

1 Like

Thanks for the information!

I nonetheless attempted to solve that by passing by reference the physics_world to specs, so keeping ownership to testbed. Unfortunately this led to an unimplemented Rust feature : https://github.com/rust-lang/rust/issues/53343

(Perhaps there’s an easier way to fix that issue that I am unaware of)

That means we have hope for the feature that we will be able to fix that.

I will attempt to check nphysics testbed source code to evaluate if simplifying nphysics::world::World access is a reachable task for me.

1 Like