UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

350 lines (156 loc) 4.69 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [PathfindingEntityController](./server.pathfindingentitycontroller.md) ## PathfindingEntityController class A pathfinding entity controller built on top of `SimpleEntityController`<!-- -->. When to use: obstacle-aware movement to a target coordinate. Do NOT use for: per-tick recalculation; pathfinding is synchronous and can be expensive. **Signature:** ```typescript export default class PathfindingEntityController extends SimpleEntityController ``` **Extends:** [SimpleEntityController](./server.simpleentitycontroller.md) ## Remarks Implements A\* pathfinding. Call `PathfindingEntityController.pathfind` sparingly; it is intended to be called once per destination in most cases. <h2>Coordinate System &amp; Model Orientation</h2> HYTOPIA uses \*\*-Z as forward\*\*. Models must be authored with their front facing -Z. The controller automatically calls `face()` to orient the entity's -Z axis toward each waypoint. \*\*Category:\*\* Controllers ## Constructors <table><thead><tr><th> Constructor </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [(constructor)(options)](./server.pathfindingentitycontroller._constructor_.md) </td><td> </td><td> Constructs a new instance of the `PathfindingEntityController` class </td></tr> </tbody></table> ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> [debug](./server.pathfindingentitycontroller.debug.md) </td><td> `readonly` </td><td> boolean </td><td> Whether to enable debug mode. </td></tr> <tr><td> [maxFall](./server.pathfindingentitycontroller.maxfall.md) </td><td> `readonly` </td><td> number </td><td> The maximum fall distance the entity can fall. \*\*Category:\*\* Controllers </td></tr> <tr><td> [maxJump](./server.pathfindingentitycontroller.maxjump.md) </td><td> `readonly` </td><td> number </td><td> The maximum jump distance the entity can jump. \*\*Category:\*\* Controllers </td></tr> <tr><td> [maxOpenSetIterations](./server.pathfindingentitycontroller.maxopensetiterations.md) </td><td> `readonly` </td><td> number </td><td> The maximum open set iterations before aborting pathfinding. \*\*Category:\*\* Controllers </td></tr> <tr><td> [speed](./server.pathfindingentitycontroller.speed.md) </td><td> `readonly` </td><td> number </td><td> The speed used for path movement. \*\*Category:\*\* Controllers </td></tr> <tr><td> [target](./server.pathfindingentitycontroller.target.md) </td><td> `readonly` </td><td> [Vector3Like](./server.vector3like.md) \| undefined </td><td> The target coordinate being pathfound to. \*\*Category:\*\* Controllers </td></tr> <tr><td> [verticalPenalty](./server.pathfindingentitycontroller.verticalpenalty.md) </td><td> `readonly` </td><td> number </td><td> The vertical penalty used during pathfinding. \*\*Category:\*\* Controllers </td></tr> <tr><td> [waypointNextIndex](./server.pathfindingentitycontroller.waypointnextindex.md) </td><td> `readonly` </td><td> number </td><td> The index of the next waypoint being approached. \*\*Category:\*\* Controllers </td></tr> <tr><td> [waypoints](./server.pathfindingentitycontroller.waypoints.md) </td><td> `readonly` </td><td> [Vector3Like](./server.vector3like.md)<!-- -->\[\] </td><td> The current waypoints being followed. \*\*Category:\*\* Controllers </td></tr> <tr><td> [waypointTimeoutMs](./server.pathfindingentitycontroller.waypointtimeoutms.md) </td><td> `readonly` </td><td> number </td><td> The timeout in milliseconds for a waypoint to be considered reached. \*\*Category:\*\* Controllers </td></tr> </tbody></table> ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [pathfind(target, speed, options)](./server.pathfindingentitycontroller.pathfind.md) </td><td> </td><td> Calculates a path and moves to the target if a path is found. Use for: one-shot navigation to a destination. Do NOT use for: high-frequency replanning; it is synchronous. </td></tr> </tbody></table>