I have added fat lines around a polygon shape as an outline. I was able to do this by looking at the example https://threejs.org/examples/#webgl_lines_fat. I am however wondering how we should import Line2, LineGeometry and LineMaterial. They don’t seem part of the THREE module. Should we copy those into our own project or do they have other names in the THREE module?
They are not part of three.module.js
, yes. When working with the npm
package of three.js
, you can import the mentioned classes via ES6 imports like so:
import { Line2 } from 'three/examples/jsm/lines/Line2.js';
import { LineMaterial } from 'three/examples/jsm/lines/LineMaterial.js';
import { LineGeometry } from 'three/examples/jsm/lines/LineGeometry.js';
Of course it depends on your build tool if you can use this (recommended) workflow. How does your project setup look like?
1 Like
Thanks @Mugen87 for your quick response. At this point I import them as you suggest and it works fine, but I just wanted to know if this was the way to go. The project is setup as a monorepo and uses webpack as a build tool.