Matter-js: terrain example not working

Created on 25 Dec 2017  路  8Comments  路  Source: liabru/matter-js

The terrain example is not working (perhaps due to outdated API call?):
matter.js:7486 Uncaught TypeError: path.getPathSegAtLength is not a function
at Object.Svg.pathToVertices (matter.js:7486)
at SVGPathElement. (terrain.js:43)
at Function.each (jquery-3.1.1.js:368)
at jQuery.fn.init.each (jquery-3.1.1.js:157)
at Object. (terrain.js:42)
at fire (jquery-3.1.1.js:3305)
at Object.fireWith [as resolveWith] (jquery-3.1.1.js:3435)
at done (jquery-3.1.1.js:9242)
at XMLHttpRequest. (jquery-3.1.1.js:9484)

bug task

All 8 comments

Did you try using the pathseg polyfill? Also see #196.

it also does not work on the official demo page

image

Oh looks like the pathseg polyfill is broken on Chrome 62 and above. I've left an issue on the author's repo here progers/pathseg#22. Hopefully he can fix.

Thanks for reporting this!

+1
I met the same bug

+1

The solution is to use the latest version of pathseg rather than the one used in the examples. I'll get it updated in the examples soon.

So do SVGs work with matter.js?
If so, can someone point me to the right direction b/c I have been looking into this for like 2.5 hours

Check out the SVG example, though support is basic and more a proof of concept than anything. If you need something more, the general idea is to cut the shape into convex parts to form a compound body.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

christianmalek picture christianmalek  路  4Comments

moe091 picture moe091  路  3Comments

BlueInt32 picture BlueInt32  路  4Comments

liabru picture liabru  路  3Comments

probityrules picture probityrules  路  4Comments