planck-js
Version:
2D JavaScript physics engine for cross-platform HTML5 game development
89 lines (48 loc) • 1.75 kB
Markdown
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [PolygonShape](polygonshape.md)
# Class: PolygonShape
## Hierarchy
* any
↳ **PolygonShape**
## Callable
▸ **PolygonShape**(`vertices`: [Vec2](vec2.md)[]): *[PolygonShape](polygonshape.md)*
*Defined in [shape/index.d.ts:58](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L58)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices` | [Vec2](vec2.md)[] |
**Returns:** *[PolygonShape](polygonshape.md)*
## Index
### Constructors
* [constructor](polygonshape.md#constructor)
### Properties
* [TYPE](polygonshape.md#static-type)
### Methods
* [getVertex](polygonshape.md#getvertex)
* [validate](polygonshape.md#validate)
## Constructors
### constructor
\+ **new PolygonShape**(`vertices`: [Vec2](vec2.md)[]): *[PolygonShape](polygonshape.md)*
*Defined in [shape/index.d.ts:60](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L60)*
**Parameters:**
Name | Type |
------ | ------ |
`vertices` | [Vec2](vec2.md)[] |
**Returns:** *[PolygonShape](polygonshape.md)*
## Properties
### `Static` TYPE
▪ **TYPE**: *"polygon"*
*Defined in [shape/index.d.ts:60](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L60)*
## Methods
### getVertex
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
*Defined in [shape/index.d.ts:70](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L70)*
**Parameters:**
Name | Type |
------ | ------ |
`index` | number |
**Returns:** *[Vec2](vec2.md)*
___
### validate
▸ **validate**(): *void*
*Defined in [shape/index.d.ts:71](https://github.com/shakiba/planck.js/blob/038d425/lib/shape/index.d.ts#L71)*
**Returns:** *void*