babbleon 70 Posted July 4, 2018 Report Share Posted July 4, 2018 Hello, Does anyone know why I get the error 'Earcut was not found, the polygon will not be built.' when using BABYLON.MeshBuilder.ExtrudePolygon? I created a PG with the exact same function, but on the PG it works fine: https://www.babylonjs-playground.com/#3DDQSZ ...click on the plane to create a shape. It does not work in my code though which is annoying.. here's the error: BJS - [06:47:49]: Earcut was not found, the polygon will not be built. Uncaught TypeError: i is not a function at t.build (babylon.js:44) at Function.t.CreatePolygon (babylon.js:32) at Function.t.ExtrudePolygon (babylon.js:32) at r.scene.onPointerDown (scene.js:60) at r._processPointerDown (babylon.js:12) at HTMLCanvasElement._onPointerDown (babylon.js:13) Thank you. Quote Link to post Share on other sites
Kesshi 89 Posted July 4, 2018 Report Share Posted July 4, 2018 Earcut is no longer included in the babylon.js build. Its optional. You have to include it manually in your project. Just download the "earcut.min.js" from here https://github.com/BabylonJS/Babylon.js/tree/master/dist and add it to your project. babbleon 1 Quote Link to post Share on other sites
babbleon 70 Posted July 4, 2018 Author Report Share Posted July 4, 2018 Thank you @Kesshi, Sorted! Quote Link to post Share on other sites
seb75 1 Posted May 3, 2019 Report Share Posted May 3, 2019 Hey, I'm also getting issues with earcut. My code using BABYLON.MeshBuilder.ExtrudePolygon with Babylon 3.3 was previously working without passing the argument earcutInjection. When i upgraded to Babylon 4.0.3, the earcutInjection parameters is now required, leading to the following error in my code 'babylon.js:16 Uncaught (in promise) ReferenceError: earcut is not defined at Function.e.ExtrudePolygon (babylon.js:16)' Could you please clarify how do you pass the earcut library to the BABYLON.MeshBuilder.ExtrudePolygon mesh builder ? I haven't done any playground as this issue is dealt with on the playgrounds examples, but I cannot understand how. Thanks for your advises ! Quote Link to post Share on other sites
Deltakosh 4315 Posted June 14, 2019 Report Share Posted June 14, 2019 We have a new forum: forum.babylonjs.com Quote Link to post Share on other sites
HiteshSahu 0 Posted December 4, 2019 Report Share Posted December 4, 2019 Add Earcut as dependency in your index HTML <script src="https://preview.babylonjs.com/earcut.min.js"></script> Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.