Closed fanmingfei closed 3 years ago
Polygon have two type, regular polygon and irregular polygon.
In Matter.js, create regular polygon use Matter.Bodies.polygon. create irregular polygon can use Matter.Vertices.create(points, body) or Matter.Svg.
Step1: Add a PhysicsType: https://github.com/eva-engine/eva.js/blob/dba678ea595aea6ea946501229d24ed2324551f2/packages/plugin-matterjs/lib/Physics.ts#L3
Step2: Create Body with polygon, vertices or svg. https://github.com/eva-engine/eva.js/blob/dba678ea595aea6ea946501229d24ed2324551f2/packages/plugin-matterjs/lib/BodiesFactory.ts#L33
regular polygon: #61
regular polygon are supported when needed.
Polygon have two type, regular polygon and irregular polygon.
In Matter.js, create regular polygon use Matter.Bodies.polygon. create irregular polygon can use Matter.Vertices.create(points, body) or Matter.Svg.
Step1: Add a PhysicsType: https://github.com/eva-engine/eva.js/blob/dba678ea595aea6ea946501229d24ed2324551f2/packages/plugin-matterjs/lib/Physics.ts#L3
Step2: Create Body with polygon, vertices or svg. https://github.com/eva-engine/eva.js/blob/dba678ea595aea6ea946501229d24ed2324551f2/packages/plugin-matterjs/lib/BodiesFactory.ts#L33