2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [ChainShape](chainshape.md)
|
|
|
|
|
|
|
|
|
|
|
|
# Class: ChainShape
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
A chain shape is a free form sequence of line segments. The chain has
|
|
|
|
|
|
two-sided collision, so you can use inside and outside collision. Therefore,
|
|
|
|
|
|
you may use any winding order. Connectivity information is used to create
|
|
|
|
|
|
smooth collisions.
|
|
|
|
|
|
|
|
|
|
|
|
WARNING: The chain will not collide properly if there are self-intersections.
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
## Hierarchy
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
* [Shape](shape.md)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
↳ **ChainShape**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Constructors
|
|
|
|
|
|
|
|
|
|
|
|
* [constructor](chainshape.md#constructor)
|
|
|
|
|
|
|
|
|
|
|
|
### Properties
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [m_count](chainshape.md#m_count)
|
|
|
|
|
|
* [m_hasNextVertex](chainshape.md#m_hasnextvertex)
|
|
|
|
|
|
* [m_hasPrevVertex](chainshape.md#m_hasprevvertex)
|
|
|
|
|
|
* [m_isLoop](chainshape.md#m_isloop)
|
|
|
|
|
|
* [m_nextVertex](chainshape.md#m_nextvertex)
|
|
|
|
|
|
* [m_prevVertex](chainshape.md#m_prevvertex)
|
|
|
|
|
|
* [m_radius](chainshape.md#m_radius)
|
|
|
|
|
|
* [m_type](chainshape.md#m_type)
|
|
|
|
|
|
* [m_vertices](chainshape.md#m_vertices)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [TYPE](chainshape.md#static-type)
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [computeAABB](chainshape.md#computeaabb)
|
|
|
|
|
|
* [computeDistanceProxy](chainshape.md#computedistanceproxy)
|
|
|
|
|
|
* [computeMass](chainshape.md#computemass)
|
|
|
|
|
|
* [getChildCount](chainshape.md#getchildcount)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getChildEdge](chainshape.md#getchildedge)
|
2021-05-08 11:13:58 -07:00
|
|
|
|
* [getNextVertex](chainshape.md#getnextvertex)
|
|
|
|
|
|
* [getPrevVertex](chainshape.md#getprevvertex)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [getRadius](chainshape.md#getradius)
|
|
|
|
|
|
* [getType](chainshape.md#gettype)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
* [getVertex](chainshape.md#getvertex)
|
2021-05-08 11:13:58 -07:00
|
|
|
|
* [isLoop](chainshape.md#isloop)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [rayCast](chainshape.md#raycast)
|
|
|
|
|
|
* [setNextVertex](chainshape.md#setnextvertex)
|
|
|
|
|
|
* [setPrevVertex](chainshape.md#setprevvertex)
|
|
|
|
|
|
* [testPoint](chainshape.md#testpoint)
|
|
|
|
|
|
* [isValid](chainshape.md#static-isvalid)
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Constructors
|
|
|
|
|
|
|
|
|
|
|
|
### constructor
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
\+ **new ChainShape**(`vertices?`: [Vec2](vec2.md)[], `loop?`: boolean): *[ChainShape](chainshape.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L57)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
`vertices?` | [Vec2](vec2.md)[] |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
`loop?` | boolean |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[ChainShape](chainshape.md)*
|
|
|
|
|
|
|
|
|
|
|
|
## Properties
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### m_count
|
|
|
|
|
|
|
|
|
|
|
|
• **m_count**: *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:51](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L51)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_hasNextVertex
|
|
|
|
|
|
|
|
|
|
|
|
• **m_hasNextVertex**: *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:55](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L55)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_hasPrevVertex
|
|
|
|
|
|
|
|
|
|
|
|
• **m_hasPrevVertex**: *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:54](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L54)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_isLoop
|
|
|
|
|
|
|
|
|
|
|
|
• **m_isLoop**: *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:57](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L57)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_nextVertex
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **m_nextVertex**: *[Vec2](vec2.md) | null*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:53](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L53)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### m_prevVertex
|
|
|
|
|
|
|
2021-05-02 17:18:33 -07:00
|
|
|
|
• **m_prevVertex**: *[Vec2](vec2.md) | null*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:52](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L52)*
|
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-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:50](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L50)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### `Static` TYPE
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
▪ **TYPE**: *"chain"* = 'chain' as 'chain'
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:48](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L48)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### computeAABB
|
|
|
|
|
|
|
|
|
|
|
|
▸ **computeAABB**(`aabb`: [AABB](aabb.md), `xf`: [Transform](transform.md), `childIndex`: number): *void*
|
|
|
|
|
|
|
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/ChainShape.ts:327](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L327)*
|
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 |
|
|
|
|
|
|
------ | ------ | ------ |
|
|
|
|
|
|
`aabb` | [AABB](aabb.md) | Returns the axis aligned box. |
|
|
|
|
|
|
`xf` | [Transform](transform.md) | The world transform of the shape. |
|
|
|
|
|
|
`childIndex` | number | The child shape |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### computeDistanceProxy
|
|
|
|
|
|
|
|
|
|
|
|
▸ **computeDistanceProxy**(`proxy`: [DistanceProxy](distanceproxy.md), `childIndex`: number): *void*
|
|
|
|
|
|
|
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/ChainShape.ts:351](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L351)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`proxy` | [DistanceProxy](distanceproxy.md) |
|
|
|
|
|
|
`childIndex` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### computeMass
|
|
|
|
|
|
|
|
|
|
|
|
▸ **computeMass**(`massData`: [MassData](massdata.md), `density?`: number): *void*
|
|
|
|
|
|
|
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/ChainShape.ts:345](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L345)*
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
Chains have zero mass.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
|
|
|
|
|
`massData` | [MassData](massdata.md) | Returns the mass data for this shape. |
|
|
|
|
|
|
`density?` | number | The density in kilograms per meter squared. |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getChildCount
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getChildCount**(): *number*
|
|
|
|
|
|
|
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/ChainShape.ts:247](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L247)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the number of child primitives.
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### getChildEdge
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getChildEdge**(`edge`: [EdgeShape](edgeshape.md), `childIndex`: number): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:253](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L253)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`edge` | [EdgeShape](edgeshape.md) |
|
|
|
|
|
|
`childIndex` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-05-08 11:13:58 -07:00
|
|
|
|
### getNextVertex
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getNextVertex**(): *[Vec2](vec2.md)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:222](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L222)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getPrevVertex
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getPrevVertex**(): *[Vec2](vec2.md)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:209](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L209)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *[Vec2](vec2.md)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### 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.
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
### getVertex
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **getVertex**(`index`: number): *[Vec2](vec2.md)*
|
2020-07-28 20:21:55 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:278](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L278)*
|
2020-07-28 20:21:55 -07: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
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-05-08 11:13:58 -07:00
|
|
|
|
### isLoop
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isLoop**(): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:287](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L287)*
|
2021-05-08 11:13:58 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### rayCast
|
|
|
|
|
|
|
|
|
|
|
|
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `xf`: [Transform](transform.md), `childIndex`: number): *boolean*
|
|
|
|
|
|
|
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/ChainShape.ts:312](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L312)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Cast a ray against a child shape.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
|
|
|
|
|
`output` | [RayCastOutput](../interfaces/raycastoutput.md) | The ray-cast results. |
|
|
|
|
|
|
`input` | [RayCastInput](../interfaces/raycastinput.md) | The ray-cast input parameters. |
|
2021-05-08 11:13:58 -07:00
|
|
|
|
`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*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setNextVertex
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setNextVertex**(`nextVertex`: [Vec2](vec2.md)): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:217](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L217)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Establish connectivity to a vertex that follows the last vertex. Don't call
|
|
|
|
|
|
this for loops.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`nextVertex` | [Vec2](vec2.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setPrevVertex
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setPrevVertex**(`prevVertex`: [Vec2](vec2.md)): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/collision/shape/ChainShape.ts:204](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L204)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Establish connectivity to a vertex that precedes the first vertex. Don't call
|
|
|
|
|
|
this for loops.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`prevVertex` | [Vec2](vec2.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### testPoint
|
|
|
|
|
|
|
|
|
|
|
|
▸ **testPoint**(`xf`: [Transform](transform.md), `p`: [Vec2](vec2.md)): *false*
|
|
|
|
|
|
|
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/ChainShape.ts:300](https://github.com/shakiba/planck.js/blob/acc3bd8/src/collision/shape/ChainShape.ts#L300)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Test a point for containment in this shape. This only works for convex
|
|
|
|
|
|
shapes.
|
|
|
|
|
|
|
|
|
|
|
|
This always return false.
|
|
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type | Description |
|
|
|
|
|
|
------ | ------ | ------ |
|
|
|
|
|
|
`xf` | [Transform](transform.md) | The shape world transform. |
|
|
|
|
|
|
`p` | [Vec2](vec2.md) | A point in world coordinates. |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *false*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### `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*
|