hytopia
Version:
The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.
98 lines (46 loc) • 1.77 kB
Markdown
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
[Home](./index.md) > [server](./server.md) > [SimpleEntityController](./server.simpleentitycontroller.md) > [face](./server.simpleentitycontroller.face.md)
## SimpleEntityController.face() method
Rotates the entity at a given speed to face a target coordinate.
Use for: turning an entity to look at a target without moving it. Do NOT use for: pitch/roll orientation; this rotates yaw only.
**Signature:**
```typescript
face(target: Vector3Like, speed: number, options?: FaceOptions): void;
```
## Parameters
<table><thead><tr><th>
Parameter
</th><th>
Type
</th><th>
Description
</th></tr></thead>
<tbody><tr><td>
target
</td><td>
[Vector3Like](./server.vector3like.md)
</td><td>
The target coordinate to face.
</td></tr>
<tr><td>
speed
</td><td>
number
</td><td>
The speed at which to rotate to the target coordinate (radians per second).
</td></tr>
<tr><td>
options
</td><td>
[FaceOptions](./server.faceoptions.md)
</td><td>
_(Optional)_ Additional options for the face operation, such as callbacks.
\*\*Category:\*\* Controllers
</td></tr>
</tbody></table>
**Returns:**
void
## Remarks
\*\*-Z forward:\*\* Orients the entity so its \*\*-Z axis\*\* points toward the target. Models must be authored with their front facing -Z for correct orientation.
\*\*Replaces previous target:\*\* If called while already facing, the previous target is discarded and the entity starts facing the new target. There is no queue.
\*\*Y-axis only:\*\* Only rotates around the Y-axis (yaw). Does not pitch up/down to face targets at different heights.