refactor: body vertices

This commit is contained in:
cha0s 2019-04-12 20:25:40 -05:00
parent 2eb2c58054
commit 62ff586777
2 changed files with 9 additions and 0 deletions

View File

@ -4,6 +4,7 @@ const decorate = compose(
virtualize([
'applyForce',
'applyImpulse',
'vertices',
]),
);

View File

@ -148,4 +148,12 @@ export class Body extends AbstractBody {
MatterBody.setStatic(this.matterBody, isStatic);
}
get vertices() {
const vertices = [];
for (const {x, y} of this.matterBody.vertices) {
vertices.push([x, y]);
}
return vertices;
}
}