hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
71 lines (33 loc) • 1.2 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [client](./client.md) > [HytopiaUI](./client.hytopiaui.md) > [lockPointer](./client.hytopiaui.lockpointer.md)
## HytopiaUI.lockPointer() method
Controls pointer lock for your UI. When locked, the cursor is hidden and mouse movement controls the camera. Call with `true` when hiding your UI so players can control the camera, `false` when showing UI that needs cursor interaction. Pointer lock only affects Desktop devices.
**Signature:**
```typescript
lockPointer(lock: boolean, maintainInput?: boolean): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
lock
</td><td>
boolean
</td><td>
`true` to lock pointer and hide cursor, `false` to unlock and show cursor
</td></tr>
<tr><td>
maintainInput
</td><td>
boolean
</td><td>
_(Optional)_ When `true`<!-- -->, keyboard movement/inputs for gameplay still work while pointer is unlocked (default: `false`<!-- -->)
</td></tr>
</tbody></table>
**Returns:**
void