schteppe / p2.js

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

Box.type is Shape.Convex #185

Closed danzel closed 8 years ago

danzel commented 8 years ago

Maybe this is done on purpose, but it seems a bit weird.

new p2.Box().type == p2.Shape.CONVEX

It looks a bit like we are trying to set the type to box here: https://github.com/schteppe/p2.js/blob/master/src/shapes/Box.js#L53 but then we pass the options up to Convex which overwrites them: https://github.com/schteppe/p2.js/blob/master/src/shapes/Convex.js#L109

Maybe change the second line to options.type = options.type || Shape.Convex?

schteppe commented 8 years ago

Not on purpose! Thanks for the heads up. The supplied options object should probably not be mutated this way either, but that's a different problem...