I’ve been struggling for the last couple days with the basic problem of using the out-of-core ConvexGeometry method in the browser. I was able to track down the root cause form this closed 2020 three.js Gitub request, but unforuately the Three.js page recommended as a solution is no longer valid. I’ve kept tried to keep trouble shooting but now need to raise my hand and ask for help.
I can see the module correctly imported through the browser console from the index.html:
But I can’t figure out a way to use it in my clients’ render.js. The index.html file and render.js are in the same public folder. How do poeple suggest this be accomplished?
function main(){
const points = //get Vector3 points
console.log(new ConvexGeometry(points))
}
main()
// returns
// ConvexGeometry is not defined at main
That’s actually a good hint in the direction I need to investigate and I did quickly make some progress after adding type="module" to my other scripts. Is there a Three.js example on how this configuration can be accomplished?
The official example us ES6 modules however it might make more sense to study a general guide about the usage of this JavaScript feature. It’s not really a three.js thing^^.