2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [BoxShape](boxshape.md)
|
|
|
|
|
|
|
|
|
|
|
|
# Class: BoxShape
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
A rectangle polygon which extend PolygonShape.
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
## Hierarchy
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
↳ [PolygonShape](polygonshape.md)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
↳ **BoxShape**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
|
|
|
|
* [constructor](boxshape.md#constructor)
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### Properties
|
|
|
|
|
|
|
|
|
|
|
|
* [m_centroid](boxshape.md#m_centroid)
|
|
|
|
|
|
* [m_count](boxshape.md#m_count)
|
|
|
|
|
|
* [m_normals](boxshape.md#m_normals)
|
|
|
|
|
|
* [m_radius](boxshape.md#m_radius)
|
|
|
|
|
|
* [m_type](boxshape.md#m_type)
|
|
|
|
|
|
* [m_vertices](boxshape.md#m_vertices)
|
|
|
|
|
|
* [TYPE](boxshape.md#static-type)
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
|
|
|
|
* [computeAABB](boxshape.md#computeaabb)
|
|
|
|
|
|
* [computeDistanceProxy](boxshape.md#computedistanceproxy)
|
|
|
|
|
|
* [computeMass](boxshape.md#computemass)
|
|
|
|
|
|
* [getChildCount](boxshape.md#getchildcount)
|
|
|
|
|
|
* [getRadius](boxshape.md#getradius)
|
|
|
|
|
|
* [getType](boxshape.md#gettype)
|
|
|
|
|
|
* [getVertex](boxshape.md#getvertex)
|
|
|
|
|
|
* [rayCast](boxshape.md#raycast)
|
|
|
|
|
|
* [testPoint](boxshape.md#testpoint)
|
|
|
|
|
|
* [validate](boxshape.md#validate)
|
|
|
|
|
|
* [isValid](boxshape.md#static-isvalid)
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
|
|
|
|
|
\+ **new BoxShape**(`hx`: number, `hy`: number, `center?`: [Vec2](vec2.md), `angle?`: number): *[BoxShape](boxshape.md)*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [PolygonShape](polygonshape.md).[constructor](polygonshape.md#constructor)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/BoxShape.ts:32](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/BoxShape.ts#L32)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`hx` | number |
|
|
|
|
|
|
`hy` | number |
|
|
|
|
|
|
`center?` | [Vec2](vec2.md) |
|
|
|
|
|
|
`angle?` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[BoxShape](boxshape.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
|
|
|
|
|
### m_centroid
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **m_centroid**: *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[m_centroid](polygonshape.md#m_centroid)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:49](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L49)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_count
|
|
|
|
|
|
|
|
|
|
|
|
• **m_count**: *number*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[m_count](polygonshape.md#m_count)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L52)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_normals
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **m_normals**: *[Vec2](vec2.md)[]*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[m_normals](polygonshape.md#m_normals)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L51)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_radius
|
|
|
|
|
|
|
|
|
|
|
|
• **m_radius**: *number*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Shape](shape.md).[m_radius](shape.md#m_radius)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Shape.ts:39](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L39)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_type
|
|
|
|
|
|
|
|
|
|
|
|
• **m_type**: *[ShapeType](../globals.md#shapetype)*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Shape](shape.md).[m_type](shape.md#m_type)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Shape.ts:38](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L38)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_vertices
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **m_vertices**: *[Vec2](vec2.md)[]*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[m_vertices](polygonshape.md#m_vertices)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L50)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### `Static` TYPE
|
|
|
|
|
|
|
|
|
|
|
|
▪ **TYPE**: *"polygon"* = 'polygon' as 'polygon'
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [PolygonShape](polygonshape.md).[TYPE](polygonshape.md#static-type)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/BoxShape.ts:32](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/BoxShape.ts#L32)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
|
|
### computeAABB
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[computeAABB](polygonshape.md#computeaabb)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Shape](shape.md).[computeAABB](shape.md#abstract-computeaabb)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:388](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L388)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Given a transform, compute the associated axis aligned bounding box for a
|
|
|
|
|
|
child shape.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
|
|
|
|
|
|
`xf` | [Transform](transform.md) | The world transform of the shape. |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
`childIndex` | number | The child shape |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### computeDistanceProxy
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md)): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[computeDistanceProxy](polygonshape.md#computedistanceproxy)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Shape](shape.md).[computeDistanceProxy](shape.md#abstract-computedistanceproxy)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:522](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L522)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`proxy` | [DistanceProxy](distanceproxy.md) |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### computeMass
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **computeMass**(`massData`: [MassData](massdata.md), `density`: number): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[computeMass](polygonshape.md#computemass)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Shape](shape.md).[computeMass](shape.md#abstract-computemass)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:413](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L413)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Compute the mass properties of this shape using its dimensions and density.
|
|
|
|
|
|
The inertia tensor is computed about the local origin.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
`density` | number | The density in kilograms per meter squared. |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getChildCount
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getChildCount**(): *1*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[getChildCount](polygonshape.md#getchildcount)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Shape](shape.md).[getChildCount](shape.md#abstract-getchildcount)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:127](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L127)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the number of child primitives.
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *1*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getRadius
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getRadius**(): *number*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Shape](shape.md).[getRadius](shape.md#getradius)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Shape.ts:62](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L62)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getType
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Shape](shape.md).[getType](shape.md#gettype)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Shape.ts:72](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L72)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the type of this shape. You can use this to down cast to the concrete
|
|
|
|
|
|
shape.
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[ShapeType](../globals.md#shapetype)*
|
|
|
|
|
|
|
|
|
|
|
|
the shape type.
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getVertex
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[getVertex](polygonshape.md#getvertex)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:98](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L98)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`index` | number |
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### rayCast
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[rayCast](polygonshape.md#raycast)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Shape](shape.md).[rayCast](shape.md#abstract-raycast)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:320](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L320)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Cast a ray against a child shape.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
|
|
|
|
|
|
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
|
|
|
|
|
|
`xf` | [Transform](transform.md) | The transform to be applied to the shape. |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
`childIndex` | number | The child shape index |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### testPoint
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *boolean*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[testPoint](polygonshape.md#testpoint)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Overrides [Shape](shape.md).[testPoint](shape.md#abstract-testpoint)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:299](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L299)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Test a point for containment in this shape. This only works for convex
|
|
|
|
|
|
shapes.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`xf` | [Transform](transform.md) | The shape world transform. |
|
|
|
|
|
|
`p` | [Vec2](vec2.md) | A point in world coordinates. |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### validate
|
|
|
|
|
|
|
|
|
|
|
|
▸ **validate**(): *boolean*
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [PolygonShape](polygonshape.md).[validate](polygonshape.md#validate)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/PolygonShape.ts:499](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/PolygonShape.ts#L499)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Validate convexity. This is a very time consuming operation.
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
true if valid
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### `Static` isValid
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
▸ **isValid**(`shape`: [Shape](shape.md) | null | undefined): *shape is Shape*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
*Inherited from [Shape](shape.md).[isValid](shape.md#static-isvalid)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/Shape.ts:58](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/Shape.ts#L58)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-05-02 17:18:33 -07:00
|
|
|
|
`shape` | [Shape](shape.md) | null | undefined |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *shape is Shape*
|