From 417dd5790b7aa42b1fde41c21d0c6d9d1d7a9201 Mon Sep 17 00:00:00 2001 From: hbaklan943 Date: Sun, 20 Aug 2023 14:06:47 +0300 Subject: [PATCH] src: Update Body.ts --- docs/api/classes/body.md | 34 +--------------------------------- src/dynamics/Body.ts | 7 +++++++ 2 files changed, 8 insertions(+), 33 deletions(-) diff --git a/docs/api/classes/body.md b/docs/api/classes/body.md index 059e185f..00ea4983 100644 --- a/docs/api/classes/body.md +++ b/docs/api/classes/body.md @@ -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) @@ -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) @@ -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* @@ -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* @@ -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* \ No newline at end of file diff --git a/src/dynamics/Body.ts b/src/dynamics/Body.ts index 89040639..28fa17d7 100644 --- a/src/dynamics/Body.ts +++ b/src/dynamics/Body.ts @@ -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);