Babylon.js 8 + Vite 6 Typescript Template with Havok Physics

With the dazzling arrival of the incredible Babylon 8.0, it’s time to update our favorite development template and share it with you!

  • Freshiest Babylon.js, Vite, Typescript and all other dependencies
  • WebGPU engine by default, WebGL2 supported as well
  • Havok Physics already set up and included in the demo scene
  • FPS Counter in the right top corner
  • Inspector - press Ctrl+Alt+Shift+I
  • Axes Viewer
  • Default Rendering Pipeline with FXAA and MSAA enabled
  • All console.log messages are cleared in the production build
  • Easy to disable not needed functions (Havok, Axes Viewer, Pipeline etc)
8 Likes

Thank you for this solution!
Previously, I didn’t know about this way to exclude dependencies in vite.config.ts:

  optimizeDeps: {
    exclude: ["@babylonjs/havok"],
  },

Before, I used a dirty hack in my code like this:

async physicsEngine() {
  const wasmBinary = await fetch('./node_modules/@babylonjs/havok/lib/esm/HavokPhysics.wasm');
  const wasmBinaryArrayBuffer = await wasmBinary.arrayBuffer();
  return HavokPhysics({
    wasmBinary: wasmBinaryArrayBuffer,
  });
}

:heart:

2 Likes

The small update - GitHub - eldinor/bp800: Babylon.js 8 + Vite 6 Typescript Template with Havok Physics

  • Tree-shaking to reduce bundle size
  • Inspector’s import only for DEV mode to reduce bundle size
5 Likes

Updated to 8.2.1

2 Likes

You’re really punctual

1 Like

Oh, I am happy to hear that!

We made a slight change to the declaration files (to support node16 and nodenext module resolutions), and though i fully tested it, anything can go wrong. So - Happy to hear that 8.2.1 is working correctly :slight_smile:

There were some things in 8.2.0 which should be corrected :slight_smile:

Thanks! :slight_smile:

1 Like