hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
114 lines (53 loc) • 2.27 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [DefaultPlayerEntityController](./server.defaultplayerentitycontroller.md) > [tickWithPlayerInput](./server.defaultplayerentitycontroller.tickwithplayerinput.md)
## DefaultPlayerEntityController.tickWithPlayerInput() method
Ticks the player movement for the entity controller, overriding the default implementation. If the entity to tick is a child entity, only the event will be emitted but the default movement logic will not be applied.
**Signature:**
```typescript
tickWithPlayerInput(entity: PlayerEntity, input: PlayerInput, cameraOrientation: PlayerCameraOrientation, deltaTimeMs: number): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
entity
</td><td>
[PlayerEntity](./server.playerentity.md)
</td><td>
The entity to tick.
</td></tr>
<tr><td>
input
</td><td>
[PlayerInput](./server.playerinput.md)
</td><td>
The current input state of the player.
</td></tr>
<tr><td>
cameraOrientation
</td><td>
[PlayerCameraOrientation](./server.playercameraorientation.md)
</td><td>
The current camera orientation state of the player.
</td></tr>
<tr><td>
deltaTimeMs
</td><td>
number
</td><td>
The delta time in milliseconds since the last tick.
\*\*Category:\*\* Controllers
</td></tr>
</tbody></table>
**Returns:**
void
## Remarks
\*\*Rotation (-Z forward):\*\* Sets entity rotation based on camera yaw. A yaw of 0 faces -Z. Movement direction offsets (WASD/joystick) are added to camera yaw to determine facing. Models must be authored with their front facing -Z.
\*\*Child entities:\*\* If `entity.parent` is set, only emits the event and returns early. Movement logic is skipped for child entities.
\*\*Input cancellation:\*\* If `autoCancelMouseLeftClick` is true (default), `input.ml` is set to `false` after processing to prevent repeated triggers.
\*\*Animations:\*\* Automatically manages idle, walk, run, jump, swim, and interact animations based on movement state and input.