Matter.js 0.15.0

Well, Merry Christmas. It looks like there was an update to Matter.js — and it was released on Christmas Eve. It's not just the release date that makes this special. The last update was over two years ago. But additionally, this line looks interesting...

Optimised performance up to ~30% boost vs. 0.14.2
https://github.com/liabru/matter-js/pull/946

30%... is that right?! That sounds huge!

It's certainly nice to see activity on this project again.

1 Like

Oh, that's great! I looked through the changes and definitely noticed one of the performance fixes is something that would impact Hype documents if there is a significant number of bodies on the page.

This won't be in the upcoming Hype v4.1.3, but I have added an item on the tracker to test and integrate it to the next release.

You may be able to try running it with Hype yourself by including the script in the head of your document. If Hype finds an existing Matter object, it will use that one instead of the one we ship with.

I tried it with the Jigsaw template. It did not work.

TypeError: decomp.makeCCW is not a function. (In 'decomp.makeCCW(concave)', 'decomp.makeCCW' is undefined)

I copied matter.min.js (and then just matter.js) to the Resources folder. Only a white screen appeared. The console log showed the error.


I then tried it with the Jump template. Replacing matter.js seems to work, but I couldn't tell if there was a significant difference with performance. (CPU usage seemed slightly higher with matter.js manually added… ~28% vs ~29% in the three moving platforms area.)

From the error, it looks like there's an incompatibility in the polygon decomposition call, which is used for vector shape-based physics bodies. So it seems this will require Hype changes to work with the new version.