Rounded Box Geometry

I want to copy the round box geometry like the one from three.js examples but when I run my code it says ‘RoundedBoxGeometry is not defined’ see my code here: Glitch :・゚✧

Looks to me that you didn’t import the module (The script links at the top are unnecessary).

		import { RoundedBoxGeometry } from './jsm/geometries/RoundedBoxGeometry.js';

When I do that it gives me these errors:

see my code here: Glitch :・゚✧

You should use a script tag script tag of type ‘module’:

import { RoundedBoxGeometry } from './jsm/geometries/RoundedBoxGeometry.js'; ...

By script tag do you mean script src=“js/RoundedBoxGeometry.js”></script because I have already done this and it’s still not working, see my code here: Glitch :・゚✧ feel free to edit it yourself

The classic way of programming with JavaScript is to use links to all the JS files needed from the Html page. A newer way is to use modules. Module type JS files can link to other modules they’re dependent on.

You’re now seem to try to use the combination of both methods, which doesn’t work.

From the Html page you correctly have the script tag given the type ‘module’. But when you want to use an external module to have to put an import statement to it (You’re doing that only for dat.gui.js now)
So you should remove the classic script links, and just add the import statements.

Furthermore - and this is what you might also have missed - for example the RoundedBoxGeometry also imports the three.js module, but the path to it should be correct. So you should check all the paths in the js files.

If you closely follow the code from the example page it should work, of course :wink:

But when I import RoundBoxGeometry module it says Loading module from “” was blocked because of a disallowed MIME type (“text/plain”)

Thanks, turns out I forgot to import build/three.module.js, it’s working now