Regarding vite-config, just in case it helps anybody: I got an error when initializing the havok plugin in my project: “Uncaught (in promise) RuntimeError: Aborted(both async and sync fetching of the wasm failed). Build with -sASSERTIONS for more info.”
Also, to make sure it works properly when you install packages (npm install will occasionally redelete the wasm file)…add a “postinstall” script in package.json.
“postinstall”: “cp ./node_modules/@babylonjs/havok/lib/esm/HavokPhysics.wasm ./node_modules/.vite/deps”
I “thought” I had it fixed, then did production build/deploy and realized I needed this. Hours of “huh, what the heck is going on here?” Probably a newbie/obvious thing, but as a newbie…was super confusing.
will you be able to share a project that requires copying the wasm to a different directory? This should be solved by your build tool so I will be interested in trying out the build tool you are using and see how it can be fixed better.
Yeah, just knowing general things such as the road map for cloth sim, maybe fluid sim, and the height field shape types would be great to know about in advance. For the moment, I’m thinking just running fluid and cloth sims on a compute shader that can take values fed to it from a cpu side program that reads out havok physics body properties is the way to go.
Just to clarify, vite does the “right” thing when you do a production build, but somehow doesn’t detect it properly when running in “dev” (aka hot reload) mode.
Reviving this…does the above work for you when running in dev mode? I tried half a dozen variations of this, and for whatever reason the wasm model would not copy over in dev mode.
Hey sorry, late response, hiking … As I said before, I do not investigate further. I just did a very quick test with the git repo above, and by copying HavokPhysics.wasm to yourproject\node_modules.vite\deps solve the issue I think. HavokPhysics is correctly downloaded and initialized versus the original git repo. (npm run dev)