rapier icon indicating copy to clipboard operation
rapier copied to clipboard

emscripten problems

Open extrawurst opened this issue 4 years ago • 2 comments

I am using rapier inside a emscripten project:

cargo b --release --target wasm32-unknown-emscripten

unfortunately I am totally stuck why it panics in instant::wasm::now. as far as I understand the instant crate is intended to exactly solve this and allow using Instant::now() on Wasm targets - even emscripten.

exception thrown: TypeError: undefined has no properties,get/obj[prop]@http://localhost:8060/tmp_js_export.js:9:25308
instant::wasm::now::hc0282aa57e236f87@http://localhost:8060/tmp_js_export.js line 9 > WebAssembly.instantiate:wasm-function[2296]:0x53bdc
rapier2d::counters::timer::Timer::resume::he366f5707f00b84f@http://localhost:8060/tmp_js_export.js line 9 > WebAssembly.instantiate:wasm-function[10653]:0xc6a5f
rapier2d::pipeline::physics_pipeline::PhysicsPipeline::detect_collisions::h7b81d128e8328730@http://localhost:8060/tmp_js_export.js line 9 > WebAssembly.instantiate:wasm-function[10644]:0xc6227
rapier2d::pipeline::physics_pipeline::PhysicsPipeline::step::hefee14a6549ee715@http://localhost:8060/tmp_js_export.js line 9 > WebAssembly.instantiate:wasm-function[436]:0x127c5

any help would be appreciated

extrawurst avatar Jun 26 '21 22:06 extrawurst

turns out emscripten exposes no now but it exposes emscripten_get_now() so we have to fix this in instant: https://github.com/sebcrozet/instant/pull/33

extrawurst avatar Jun 27 '21 07:06 extrawurst

sorry for bothering you, how did you import rapier on emscripten project? There is some tutorial or something?

APerricone avatar Jan 24 '22 06:01 APerricone

Closing this issue since the fix in instant has been merged and published for a while now. Please open a new issue in the problem persists.

sebcrozet avatar Mar 23 '24 10:03 sebcrozet