There's quite a few cases where it can be useful to reuse your paths, but apparently when I call Body.fromPolygon, my paths arrays are emptied. Example:
var legPath = // My character's beautiful leg shape :)
var frontLeg = new p2.Body({
// some properties
});
var backLeg = new p2.Body({
// some properties
});
frontLeg.fromPolygon(legPath);
// at this time my beautiful leg path is an empty array :(
backLeg.fromPolygon(legPath);
Some people also consider it's a bad practice to modify the function arguments unless it's explicit (and I agree, it's probably something you don't expect).
There's quite a few cases where it can be useful to reuse your paths, but apparently when I call Body.fromPolygon, my paths arrays are emptied. Example:
Some people also consider it's a bad practice to modify the function arguments unless it's explicit (and I agree, it's probably something you don't expect).