First, #Evergine is our cross-platform graphic engine, developed (almost) entirely in .NET
We want all the engine code to be ported to the web platform. For that purpose, we are using #NET6 and #Blazor, that help us to compile our engine to #WASM.
To render with #WebGL in #Evergine, we are using #emscripten and it's awesome EGL emulation.
This allows us to use exactly the same code in C# that we are using in our existing #OpenGL integration (less code to maintain 😅)
https://emscripten.org/docs/porting/multimedia_and_graphics/EGL-Support-in-Emscripten.html
So, let's talk about Physics...
In #Evergine we are using #BulletPhysics as our main physic engine. Bullet is a good open-source library maintained by Erwin Coumans
To use #BulletEngine in Evergine, we need to consume this C++ library into our C# engine.
And to perform this task, we are adapted BulletSharpPInvoke:
https://github.com/AndresTraks/BulletSharpPInvoke
This project provides a C# wrapper that make native calls to Bullet library using PInvokes.
Finally, we need to build Bullet libraries for each Evergine platform that we want to support (Windows, Android, Web...)
In the case of Web, we are adapted the provided CMake scripts to use the #Emscripten toolchain, to produce the final Bullet #WASM libraries.