# RigidBodyComponentElement

Class · extends [`ComponentElement`](https://api.playcanvas.com/web-components/classes/ComponentElement.md)`<RigidBodyComponent>` · category: Components

Source: https://github.com/playcanvas/web-components/blob/b95efbfac5c64c11284a27e8e18224700d05fc77/src/components/rigid-body-component.ts#L23

The RigidBodyComponentElement interface provides properties and methods for manipulating
[`<pc-rigid-body>`](https://developer.playcanvas.com/user-manual/web-components/tags/pc-rigid-body/) elements.
The RigidBodyComponentElement interface also inherits the properties and methods of the
[HTMLElement](https://developer.mozilla.org/docs/Web/API/HTMLElement) interface.

Engine component: [RigidBodyComponent](https://api.playcanvas.com/engine/classes/RigidBodyComponent.html) (`rigidbody`).

**elementSummary** The `<pc-rigid-body>` element hands its entity to the physics simulation, with
attributes for its type, mass, friction and restitution. It needs a sibling `<pc-collision>` for
its shape, and `Ammo` loaded through `<pc-wasm>`. Must be a child of a `<pc-entity>`,
`<pc-model>` or `<pc-node>`.

## Accessors

### angularDamping

```ts
get angularDamping(): number
set angularDamping(value: number)
```

Gets the rate at which the body loses angular velocity over time, from 0 (none) to 1.

### angularFactor

```ts
get angularFactor(): Vec3
set angularFactor(value: Vec3)
```

Gets the scaling applied to the body's rotation about each axis: 0 locks an axis and 1 leaves
it free.

### component

```ts
get component(): RigidBodyComponent | null
```

Gets the underlying PlayCanvas rigidbody component. `null` until the element is
ready — see [ComponentElement.component](https://api.playcanvas.com/web-components/classes/ComponentElement.md#component).

### friction

```ts
get friction(): number
set friction(value: number)
```

Gets the friction applied where the body contacts another, from 0 (slides freely) to 1
(grips).

### linearDamping

```ts
get linearDamping(): number
set linearDamping(value: number)
```

Gets the rate at which the body loses linear velocity over time, from 0 (none) to 1.

### linearFactor

```ts
get linearFactor(): Vec3
set linearFactor(value: Vec3)
```

Gets the scaling applied to the body's movement along each axis: 0 locks an axis and 1 leaves
it free.

### mass

```ts
get mass(): number
set mass(value: number)
```

Gets the mass of the body, which applies to `dynamic` bodies only.

### restitution

```ts
get restitution(): number
set restitution(value: number)
```

Gets the bounciness of the body, from 0 (all energy lost in a collision) to 1 (none lost).

### rollingFriction

```ts
get rollingFriction(): number
set rollingFriction(value: number)
```

Gets the friction that resists the body rolling across a contact, where `friction` resists it
sliding.

### type

```ts
get type(): "static" | "dynamic" | "kinematic"
set type(value: "static" | "dynamic" | "kinematic")
```

Gets how the body takes part in the simulation: `static`, `dynamic` or `kinematic`.

## Methods

### getInitialComponentData

```ts
protected getInitialComponentData(): { angularDamping: number; angularFactor: Vec3; friction: number; linearDamping: number; linearFactor: Vec3; mass: number; restitution: number; rollingFriction: number; type: "static" | "dynamic" | "kinematic" }
```

Returns the data the component is created with. Overridden by subclasses to supply the
initial values of their cached properties.

**Returns** `{ angularDamping: number; angularFactor: Vec3; friction: number; linearDamping: number; linearFactor: Vec3; mass: number; restitution: number; rollingFriction: number; type: "static" | "dynamic" | "kinematic" }`: The initial component data.

## Inherited from [ComponentElement](https://api.playcanvas.com/web-components/classes/ComponentElement.md)

- `get closestApp(): AppElement | null`
- `get closestEntity(): EntityBaseElement | null`
- `get enabled(): boolean` · `set enabled(value: boolean)`
- `protected _onReady(): void`
- `protected _resetReady(): void`
- `protected initComponent(): void`
- `ready(): Promise<RigidBodyComponentElement>`
