question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

decomp.Polygon is not a constructor

See original GitHub issue

When I’m using Bodies.fromVertices, I receive this error:

Uncaught TypeError: decomp.Polygon is not a constructor at Object.n.fromVertices (matter.min.js:49)

I’ve already included decomp.min.js at index.html:

<script src="js/matterjs/decomp.min.js" type="text/javascript"></script>
  <script src="js/matterjs/matter.min.js"></script>

I’m using this code:

Bodies.fromVertices(0, 0, [], {
    isStatic: true
});

What is wrong?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
photonstormcommented, Nov 26, 2017

@Chinafreak the version of Matter.js in the zip file you uploaded above is really old, it’s version 0.10.0. You need 0.13.0. You said you had the latest version from the build folder here, but that is not what is in your zip file, so I think something got mixed up somewhere.

Put the proper version in and you won’t get this error.

0reactions
liabrucommented, Dec 29, 2020

See my latest comment on #559 for an update on this, but essentially try using 0.15.0 as that should solve problems with the require. Let me know in that thread if there are other problems, so closing this one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

EarClipping - javadoc.io
The polygon to decompose must be 4 or more vertices. This algorithm creates a valid triangulation (N - 2) triangles, then employs the...
Read more >
TGeoPolygon Class Reference - ROOT
For creating a polygon without TGeoXtru class, one has to call the constructor TGeoPolygon(nvert) and then SetXY(Double_t *x, Double_t *y) providing the arrays ......
Read more >
Decomposition · GeometryBasics.jl - Julia Geometry
GeometryBasics defines an interface to decompose abstract geometries into points and ... With these methods defined, this constructor will magically work:
Read more >
webpack imported module is not a constructor - Stack Overflow
I created a small JS module which I intend to make an npm package, but for now is just on GitHub. This module...
Read more >
ompl::control::TriangularDecomposition Class Reference
The triangulation will respect the boundaries of any regions of interest, given as a list of polygons. No two obstacles may overlap, and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found