Unable to load DynamicTerrain extension as a module

I’m new to Babylonjs. A little frustrated by my inability to include the DynamicTerrain extension as a module in my app.ts file. I downloaded the js file locally and include the following statement in app.ts … What am I missing here?

let DynamicTerrain = require(’…/public/js/DynamicTerrain.min.js’);

gives error:

bundleName.js:12175 Uncaught TypeError: Cannot read properties of undefined (reading ‘Zero’)

Thanks in advance.

The DynamicTerrain module (written by @jerome ) requires the BABYLON global namespace.

define window.BABYLON = YourBabylonImport and it should work as expected.

1 Like

Hi @Polymorrah just checking in! Were you able to import the extension? :smiley:

Hi @carolhmj, thanks for asking. I honestly can’t remember now. I think I succeeded but realised that there was an easier way to achieve what I wanted with a GroundMesh. This was day 1 of learning Babylon, and I’ve been quite immersed in it since then, and still learning. Cheers.

1 Like

Hurray for learning! :grinning_face_with_smiling_eyes: We’ll always be here to help you on this path!

1 Like