babbleon Posted July 4, 2018 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 comment Share on other sites More sharing options...
Kesshi Posted July 4, 2018 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 comment Share on other sites More sharing options...
babbleon Posted July 4, 2018 Author Share Posted July 4, 2018 Thank you @Kesshi, Sorted! Quote Link to comment Share on other sites More sharing options...
seb75 Posted May 3, 2019 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 comment Share on other sites More sharing options...
Guest Posted June 14, 2019 Share Posted June 14, 2019 We have a new forum: forum.babylonjs.com Quote Link to comment Share on other sites More sharing options...
HiteshSahu Posted December 4, 2019 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 comment Share on other sites More sharing options...
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.