<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [server](./server.md) &gt; [DefaultPlayerEntityController](./server.defaultplayerentitycontroller.md) &gt; [attach](./server.defaultplayerentitycontroller.attach.md)

## DefaultPlayerEntityController.attach() method

Called when the controller is attached to an entity.

**Signature:**

```typescript
attach(entity: Entity): void;
```

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

entity


</td><td>

[Entity](./server.entity.md)


</td><td>

The entity to attach the controller to.

\*\*Category:\*\* Controllers


</td></tr>
</tbody></table>
**Returns:**

void

## Remarks

\*\*Wraps `applyImpulse`<!-- -->:\*\* The entity's `applyImpulse` method is wrapped to track external velocities separately from internal movement. External impulses decay over time when grounded.

\*\*Locks rotations:\*\* Calls `entity.lockAllRotations()` to prevent physics from rotating the entity. Rotation is set explicitly by the controller based on camera orientation.

\*\*Enables CCD:\*\* Enables continuous collision detection on the entity.

\*\*Swimming detection:\*\* Registers a `BLOCK_COLLISION` listener to detect liquid blocks and manage swimming state, gravity scale, and animations.

