2020-07-28 20:21:55 -07:00
|
|
|
|
[Planck.js API Doc](../README.md) › [Globals](../globals.md) › [Fixture](fixture.md)
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
# Class: Fixture
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
A fixture is used to attach a shape to a body for collision detection. A
|
|
|
|
|
|
fixture inherits its transform from its parent. Fixtures hold additional
|
2021-05-11 18:30:36 -07:00
|
|
|
|
non-geometric data such as friction, collision filters, etc.
|
|
|
|
|
|
|
|
|
|
|
|
To create a new Fixture use [Body.createFixture](body.md#createfixture).
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2020-07-27 00:12:01 -07:00
|
|
|
|
## Hierarchy
|
|
|
|
|
|
|
|
|
|
|
|
* **Fixture**
|
|
|
|
|
|
|
|
|
|
|
|
## Index
|
|
|
|
|
|
|
|
|
|
|
|
### Methods
|
|
|
|
|
|
|
|
|
|
|
|
* [createProxies](fixture.md#createproxies)
|
|
|
|
|
|
* [destroyProxies](fixture.md#destroyproxies)
|
|
|
|
|
|
* [getAABB](fixture.md#getaabb)
|
|
|
|
|
|
* [getBody](fixture.md#getbody)
|
|
|
|
|
|
* [getDensity](fixture.md#getdensity)
|
|
|
|
|
|
* [getFilterCategoryBits](fixture.md#getfiltercategorybits)
|
|
|
|
|
|
* [getFilterGroupIndex](fixture.md#getfiltergroupindex)
|
|
|
|
|
|
* [getFilterMaskBits](fixture.md#getfiltermaskbits)
|
|
|
|
|
|
* [getFriction](fixture.md#getfriction)
|
|
|
|
|
|
* [getMassData](fixture.md#getmassdata)
|
|
|
|
|
|
* [getNext](fixture.md#getnext)
|
|
|
|
|
|
* [getRestitution](fixture.md#getrestitution)
|
|
|
|
|
|
* [getShape](fixture.md#getshape)
|
|
|
|
|
|
* [getType](fixture.md#gettype)
|
|
|
|
|
|
* [getUserData](fixture.md#getuserdata)
|
|
|
|
|
|
* [isSensor](fixture.md#issensor)
|
|
|
|
|
|
* [rayCast](fixture.md#raycast)
|
|
|
|
|
|
* [refilter](fixture.md#refilter)
|
|
|
|
|
|
* [setDensity](fixture.md#setdensity)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [setFilterCategoryBits](fixture.md#setfiltercategorybits)
|
2020-07-27 00:12:01 -07:00
|
|
|
|
* [setFilterData](fixture.md#setfilterdata)
|
2021-04-16 17:10:15 +02:00
|
|
|
|
* [setFilterGroupIndex](fixture.md#setfiltergroupindex)
|
|
|
|
|
|
* [setFilterMaskBits](fixture.md#setfiltermaskbits)
|
2020-07-27 00:12:01 -07:00
|
|
|
|
* [setFriction](fixture.md#setfriction)
|
|
|
|
|
|
* [setRestitution](fixture.md#setrestitution)
|
|
|
|
|
|
* [setSensor](fixture.md#setsensor)
|
|
|
|
|
|
* [setUserData](fixture.md#setuserdata)
|
|
|
|
|
|
* [shouldCollide](fixture.md#shouldcollide)
|
|
|
|
|
|
* [synchronize](fixture.md#synchronize)
|
|
|
|
|
|
* [testPoint](fixture.md#testpoint)
|
|
|
|
|
|
|
|
|
|
|
|
## Methods
|
|
|
|
|
|
|
|
|
|
|
|
### createProxies
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
▸ **createProxies**(`broadPhase`: [BroadPhase](broadphase.md), `xf`: [Transform](transform.md)): *void*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:369](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L369)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
These support body activation/deactivation.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
`broadPhase` | [BroadPhase](broadphase.md) |
|
2020-07-27 00:12:01 -07:00
|
|
|
|
`xf` | [Transform](transform.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### destroyProxies
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
▸ **destroyProxies**(`broadPhase`: [BroadPhase](broadphase.md)): *void*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:382](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L382)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
`broadPhase` | [BroadPhase](broadphase.md) |
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getAABB
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getAABB**(`childIndex`: number): *[AABB](aabb.md)*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:361](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L361)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the fixture's AABB. This AABB may be enlarge and/or stale. If you need a
|
|
|
|
|
|
more accurate AABB, compute it using the shape and the body transform.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`childIndex` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *[AABB](aabb.md)*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getBody
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getBody**(): *[Body](body.md)*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:277](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L277)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the parent body of this fixture. This is null if the fixture is not
|
|
|
|
|
|
attached.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *[Body](body.md)*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getDensity
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getDensity**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:291](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L291)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the density of this fixture.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getFilterCategoryBits
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getFilterCategoryBits**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:435](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L435)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getFilterGroupIndex
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getFilterGroupIndex**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:427](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L427)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getFilterMaskBits
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getFilterMaskBits**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:443](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L443)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getFriction
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getFriction**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:307](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L307)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the coefficient of friction, usually in the range [0,1].
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getMassData
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
▸ **getMassData**(`massData`: [MassData](massdata.md)): *void*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:353](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L353)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the mass data for this fixture. The mass data is based on the density and
|
|
|
|
|
|
the shape. The rotational inertia is about the shape's origin. This operation
|
|
|
|
|
|
may be expensive.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
`massData` | [MassData](massdata.md) |
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getNext
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getNext**(): *[Fixture](fixture.md) | null*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:284](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L284)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the next fixture in the parent body's fixture list.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *[Fixture](fixture.md) | null*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getRestitution
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getRestitution**(): *number*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:322](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L322)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the coefficient of restitution.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *number*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getShape
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getShape**(): *[Shape](shape.md)*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:229](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L229)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the child shape. You can modify the child shape, however you should not
|
|
|
|
|
|
change the number of vertices because this will crash some collision caching
|
|
|
|
|
|
mechanisms. Manipulating the shape may lead to non-physical behavior.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *[Shape](shape.md)*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getType
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
▸ **getType**(): *[ShapeType](../globals.md#shapetype)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:220](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L220)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the type of the child shape. You can use this to down cast to the
|
|
|
|
|
|
concrete shape.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
**Returns:** *[ShapeType](../globals.md#shapetype)*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### getUserData
|
|
|
|
|
|
|
|
|
|
|
|
▸ **getUserData**(): *unknown*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:262](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L262)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Get the user data that was assigned in the fixture definition. Use this to
|
|
|
|
|
|
store your application specific data.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *unknown*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### isSensor
|
|
|
|
|
|
|
|
|
|
|
|
▸ **isSensor**(): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:237](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L237)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
A sensor shape collects contact information but never generates a collision
|
|
|
|
|
|
response.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### rayCast
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
▸ **rayCast**(`output`: [RayCastOutput](../interfaces/raycastoutput.md), `input`: [RayCastInput](../interfaces/raycastinput.md), `childIndex`: number): *boolean*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:344](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L344)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Cast a ray against this shape.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
`output` | [RayCastOutput](../interfaces/raycastoutput.md) |
|
|
|
|
|
|
`input` | [RayCastInput](../interfaces/raycastinput.md) |
|
2020-07-27 00:12:01 -07:00
|
|
|
|
`childIndex` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### refilter
|
|
|
|
|
|
|
|
|
|
|
|
▸ **refilter**(): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:455](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L455)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Call this if you want to establish collision that was previously disabled by
|
|
|
|
|
|
ContactFilter.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setDensity
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setDensity**(`density`: number): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:299](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L299)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the density of this fixture. This will _not_ automatically adjust the
|
|
|
|
|
|
mass of the body. You must call Body.resetMassData to update the body's mass.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`density` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### setFilterCategoryBits
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setFilterCategoryBits**(`categoryBits`: number): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:439](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L439)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`categoryBits` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-27 00:12:01 -07:00
|
|
|
|
### setFilterData
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setFilterData**(`filter`: object): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:420](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L420)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the contact filtering data. This will not update contacts until the next
|
|
|
|
|
|
time step when either parent body is active and awake. This automatically
|
|
|
|
|
|
calls refilter.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
▪ **filter**: *object*
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`categoryBits` | number |
|
|
|
|
|
|
`groupIndex` | number |
|
|
|
|
|
|
`maskBits` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
### setFilterGroupIndex
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
▸ **setFilterGroupIndex**(`groupIndex`: number): *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:431](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L431)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`groupIndex` | number |
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
**Returns:** *void*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setFilterMaskBits
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setFilterMaskBits**(`maskBits`: number): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:447](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L447)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`maskBits` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
2020-07-27 00:12:01 -07:00
|
|
|
|
### setFriction
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setFriction**(`friction`: number): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:315](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L315)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the coefficient of friction. This will not change the friction of
|
|
|
|
|
|
existing contacts.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`friction` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setRestitution
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setRestitution**(`restitution`: number): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:330](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L330)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the coefficient of restitution. This will not change the restitution of
|
|
|
|
|
|
existing contacts.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`restitution` | number |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setSensor
|
|
|
|
|
|
|
|
|
|
|
|
▸ **setSensor**(`sensor`: boolean): *void*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:244](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L244)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set if this fixture is a sensor.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`sensor` | boolean |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### setUserData
|
|
|
|
|
|
|
2021-04-16 17:10:15 +02:00
|
|
|
|
▸ **setUserData**(`data`: unknown): *void*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:269](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L269)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Set the user data. Use this to store your application specific data.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2021-04-16 17:10:15 +02:00
|
|
|
|
`data` | unknown |
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### shouldCollide
|
|
|
|
|
|
|
|
|
|
|
|
▸ **shouldCollide**(`that`: [Fixture](fixture.md)): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:496](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L496)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Implement this method to provide collision filtering, if you want finer
|
|
|
|
|
|
control over contact creation.
|
|
|
|
|
|
|
|
|
|
|
|
Return true if contact calculations should be performed between these two
|
|
|
|
|
|
fixtures.
|
|
|
|
|
|
|
|
|
|
|
|
Warning: for performance reasons this is only called when the AABBs begin to
|
|
|
|
|
|
overlap.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`that` | [Fixture](fixture.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### synchronize
|
|
|
|
|
|
|
2020-07-28 20:21:55 -07:00
|
|
|
|
▸ **synchronize**(`broadPhase`: [BroadPhase](broadphase.md), `xf1`: [Transform](transform.md), `xf2`: [Transform](transform.md)): *void*
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:397](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L397)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Updates this fixture proxy in broad-phase (with combined AABB of current and
|
|
|
|
|
|
next transformation).
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
2020-07-28 20:21:55 -07:00
|
|
|
|
`broadPhase` | [BroadPhase](broadphase.md) |
|
2020-07-27 00:12:01 -07:00
|
|
|
|
`xf1` | [Transform](transform.md) |
|
|
|
|
|
|
`xf2` | [Transform](transform.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *void*
|
|
|
|
|
|
|
|
|
|
|
|
___
|
|
|
|
|
|
|
|
|
|
|
|
### testPoint
|
|
|
|
|
|
|
|
|
|
|
|
▸ **testPoint**(`p`: [Vec2](vec2.md)): *boolean*
|
|
|
|
|
|
|
2021-05-11 18:30:36 -07:00
|
|
|
|
*Defined in [src/dynamics/Fixture.ts:337](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Fixture.ts#L337)*
|
2021-04-16 17:10:15 +02:00
|
|
|
|
|
|
|
|
|
|
Test a point in world coordinates for containment in this fixture.
|
2020-07-27 00:12:01 -07:00
|
|
|
|
|
|
|
|
|
|
**Parameters:**
|
|
|
|
|
|
|
|
|
|
|
|
Name | Type |
|
|
|
|
|
|
------ | ------ |
|
|
|
|
|
|
`p` | [Vec2](vec2.md) |
|
|
|
|
|
|
|
|
|
|
|
|
**Returns:** *boolean*
|