decomp.Polygon is not a constructor
See original GitHub issueWhen 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:
- Created 6 years ago
- Comments:15 (5 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@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.
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.