Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the "BufferGeometryUtils.js" for three.js?

Tags:

three.js

Although I am not a pro in javascript, I've been using three.js for a few months (I juste have the "three.js" script in my main folder) and I wanted to use a function from BufferGeometryUtils. I tried with the same technic but it didn't work and I got this error : "Uncaught ReferenceError: BufferGeometry is not defined at Object.mergeBufferGeometries (BufferGeometryUtils.js:202)" (my version of three.js is only a few weeks old). I saw another post about this problem but it didn't work for me as it was an older version of Three.js. So how can I use these functions in my script please ?

like image 763
C. Roux Avatar asked Oct 31 '25 06:10

C. Roux


1 Answers

THREE.BufferGeometryUtils is no part of the core but you can easily import the utils like so:

 import { BufferGeometryUtils } from 'three/examples/jsm/utils/BufferGeometryUtils.js';

As you can see, the class is part of the JSM library which means it's available as a module.

three.js R104

like image 85
Mugen87 Avatar answered Nov 03 '25 01:11

Mugen87



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!