Jump to content

(Earcut was not found) ExtrudePolygon

Recommended Posts


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.

Link to post
Share on other sites
  • 9 months later...


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 !

Link to post
Share on other sites
  • 1 month later...
  • 5 months later...

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.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...