dimforge / nphysics

2 and 3-dimensional rigid body physics engine for Rust.
https://nphysics.org
Apache License 2.0
1.63k stars 121 forks source link

v0.13 doesn't build with wasm_bindgen #241

Closed cauthmann closed 4 years ago

cauthmann commented 4 years ago

Hello,

I'm trying to use nphysics3d in a wasm-bindgen/wasm-pack project. Moving timer functionality into the instant crate was a good move, but the crate isn't wired up correctly in nphysics.

For example, build/nphysics3d/Cargo.toml says:

[features]
default = [ "dim3", "stdweb" ]
use-wasm-bindgen = [ "dim3", "wasm-bindgen", "web-sys" ]
dim3    = [ ]

[dependencies]
instant    = { version = "0.1", features = [ "stdweb", "now" ]}

instant will always use stdweb. I used a local copy with a slightly changed Cargo.toml:

[features]
default = [ "dim3", "stdweb", "instant/stdweb" ]
use-wasm-bindgen = [ "dim3", "wasm-bindgen", "web-sys", "instant/wasm-bindgen" ]
dim3    = [ ]

[dependencies]
instant    = { version = "0.1", features = [ "now" ]}

I can confirm that these changes allow my project to build with nphysics3d, both native and with wasm-bindgen. I couldn't test whether stdweb still works (hence this is a bug report and not a patch. sorry.)

johnellmore commented 4 years ago

I had the same issue with v0.13.0 a few weeks ago. Switching my Cargo.toml to use the git repository directly as a dependency (versus just the v0.13.0 version from crates.io) works great now that #242 is merged. Thanks @wsuchy!

Is there a chance to make a point release (v0.13.1) which just includes this fix?

sebcrozet commented 4 years ago

@johnellmore The version 0.13.1 is now released with this fix.

cauthmann commented 4 years ago

v0.13.1 works for me.

Thanks wsuchy and sebrozet!