schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 330 forks source link

Bug: addPolygon mutates the array #297

Closed nightwolfz closed 7 years ago

nightwolfz commented 7 years ago
const points = [[0,0], [1,1]]
const something = ... // create object here

something.body.addPolygon(null, points)
console.log(points.map(x => x))
schteppe commented 7 years ago

I believe this was fixed in https://github.com/schteppe/p2.js/commit/de568a2a89241d7c0e4cd5c36ed8204ee108d46c