Skip to content

Commit

Permalink
src: Update Body.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
hbaklan943 committed Aug 20, 2023
1 parent cb598ea commit 417dd57
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 33 deletions.
34 changes: 1 addition & 33 deletions docs/api/classes/body.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ To create a new Body use [World.createBody](world.md#createbody).
* [getNext](body.md#getnext)
* [getPosition](body.md#getposition)
* [getTransform](body.md#gettransform)
* [getType](body.md#gettype)
* [getUserData](body.md#getuserdata)
* [getWorld](body.md#getworld)
* [getWorldCenter](body.md#getworldcenter)
Expand Down Expand Up @@ -81,7 +80,6 @@ To create a new Body use [World.createBody](world.md#createbody).
* [setSleepingAllowed](body.md#setsleepingallowed)
* [setStatic](body.md#setstatic)
* [setTransform](body.md#settransform)
* [setType](body.md#settype)
* [setUserData](body.md#setuserdata)
* [shouldCollide](body.md#shouldcollide)
* [synchronizeFixtures](body.md#synchronizefixtures)
Expand Down Expand Up @@ -593,18 +591,6 @@ Get the world transform for the body's origin.

___

### getType

**getType**(): *BodyType*

*Defined in [src/dynamics/Body.ts:381](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Body.ts#L381)*

Get the type of the body.

**Returns:** *[BodyType](../globals.md#bodytype)*

___

### getUserData

**getUserData**(): *unknown*
Expand Down Expand Up @@ -1067,24 +1053,6 @@ Name | Type | Description |

___

### setType

**setType**(`type`: [BodyType](../globals.md#bodytype)): *void*

*Defined in [src/dynamics/Body.ts:388](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Body.ts#L388)*

Set the type of the body to "static", "kinematic" or "dynamic".

**Parameters:**

Name | Type | Description |
------ | ------ | ------ |
`type` | [BodyType](../globals.md#bodytype) | The type of the body. |

**Returns:** *void*

___

### setUserData

**setUserData**(`data`: any): *void*
Expand Down Expand Up @@ -1138,4 +1106,4 @@ ___

*Defined in [src/dynamics/Body.ts:586](https://github.com/shakiba/planck.js/blob/acc3bd8/src/dynamics/Body.ts#L586)*

**Returns:** *void*
**Returns:** *void*
7 changes: 7 additions & 0 deletions src/dynamics/Body.ts
Original file line number Diff line number Diff line change
Expand Up @@ -384,10 +384,17 @@ export class Body {
return this;
}

/**
* Get the type of the body.
*/
getType(): BodyType {
return this.m_type;
}

/**
* Set the type of the body to "static", "kinematic" or "dynamic".
* @param type The type of the body.
*/
setType(type: BodyType): void {
_ASSERT && console.assert(type === STATIC || type === KINEMATIC || type === DYNAMIC);
_ASSERT && console.assert(this.isWorldLocked() == false);
Expand Down

0 comments on commit 417dd57

Please sign in to comment.