UNPKG

hytopia

Version:

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

100 lines (47 loc) 1.97 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [SimpleEntityController](./server.simpleentitycontroller.md) &gt; [move](./server.simpleentitycontroller.move.md) ## SimpleEntityController.move() method Moves the entity at a given speed in a straight line to a target coordinate. Use for: simple straight-line movement. Do NOT use for: obstacle avoidance; use `PathfindingEntityController`<!-- -->. **Signature:** ```typescript move(target: Vector3Like, speed: number, options?: MoveOptions): 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 move to. </td></tr> <tr><td> speed </td><td> number </td><td> The speed at which to move to the target coordinate (blocks per second). </td></tr> <tr><td> options </td><td> [MoveOptions](./server.moveoptions.md) </td><td> _(Optional)_ Additional options for the move operation, such as callbacks. \*\*Category:\*\* Controllers </td></tr> </tbody></table> **Returns:** void ## Remarks \*\*Position only:\*\* This method only changes position, not rotation. Use `face()` simultaneously to rotate the entity toward its movement direction (-Z forward). \*\*Replaces previous target:\*\* If called while already moving, the previous target is discarded and the entity starts moving to the new target. There is no queue. \*\*Straight line:\*\* Moves directly toward target using `entity.setPosition()`<!-- -->. Does not pathfind around obstacles. \*\*Animations:\*\* Starts `moveLoopedAnimations` on the first tick of movement. When complete, starts `idleLoopedAnimations` (unless `moveStartIdleAnimationsOnCompletion` is false).