hytopia 0.1.27 → 0.1.30
Sign up to get free protection for your applications and to get access to all the features.
- package/bin/scripts.js +1 -0
- package/docs/server.basecharactercontroller.md +5 -5
- package/docs/server.basecharactercontroller.ontick.md +13 -0
- package/docs/server.basecharactercontroller.tick.md +53 -0
- package/docs/server.blocktype.md +2 -2
- package/docs/server.blocktype.onentitycollision.md +1 -1
- package/docs/server.blocktype.onentitycontactforce.md +1 -1
- package/docs/server.defaultcharactercontroller.canjump.md +1 -1
- package/docs/server.defaultcharactercontroller.canrun.md +1 -1
- package/docs/server.defaultcharactercontroller.canwalk.md +1 -1
- package/docs/server.defaultcharactercontroller.md +3 -17
- package/docs/server.entity.createcustomcharactercontroller.md +2 -2
- package/docs/server.entity.md +9 -9
- package/docs/server.entity.onblockcollision.md +1 -1
- package/docs/server.entity.onblockcontactforce.md +1 -1
- package/docs/server.entity.ondespawn.md +1 -1
- package/docs/server.entity.onentitycollision.md +1 -1
- package/docs/server.entity.onentitycontactforce.md +1 -1
- package/docs/server.entity.onspawn.md +1 -1
- package/docs/server.entity.ontick.md +1 -1
- package/docs/server.entityoptions.createcustomcharactercontroller.md +13 -0
- package/docs/server.entityoptions.md +19 -0
- package/docs/server.facecallback.md +15 -0
- package/docs/server.facecompletecallback.md +15 -0
- package/docs/server.faceoptions.md +18 -0
- package/docs/server.hytopia.basecharactercontroller.md +5 -5
- package/docs/server.hytopia.basecharactercontroller.ontick.md +13 -0
- package/docs/server.hytopia.basecharactercontroller.tick.md +53 -0
- package/docs/server.hytopia.blocktype.md +2 -2
- package/docs/server.hytopia.blocktype.onentitycollision.md +1 -1
- package/docs/server.hytopia.blocktype.onentitycontactforce.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.canjump.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.canrun.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.canwalk.md +1 -1
- package/docs/server.hytopia.defaultcharactercontroller.md +3 -17
- package/docs/server.hytopia.entity.createcustomcharactercontroller.md +2 -2
- package/docs/server.hytopia.entity.md +9 -9
- package/docs/server.hytopia.entity.onblockcollision.md +1 -1
- package/docs/server.hytopia.entity.onblockcontactforce.md +1 -1
- package/docs/server.hytopia.entity.ondespawn.md +1 -1
- package/docs/server.hytopia.entity.onentitycollision.md +1 -1
- package/docs/server.hytopia.entity.onentitycontactforce.md +1 -1
- package/docs/server.hytopia.entity.onspawn.md +1 -1
- package/docs/server.hytopia.entity.ontick.md +1 -1
- package/docs/server.hytopia.entityoptions.createcustomcharactercontroller.md +13 -0
- package/docs/server.hytopia.entityoptions.md +19 -0
- package/docs/server.hytopia.facecallback.md +15 -0
- package/docs/server.hytopia.facecompletecallback.md +15 -0
- package/docs/server.hytopia.faceoptions.md +18 -0
- package/docs/server.hytopia.md +77 -0
- package/docs/server.hytopia.movecallback.md +15 -0
- package/docs/server.hytopia.movecompletecallback.md +15 -0
- package/docs/server.hytopia.moveoptions.md +23 -0
- package/docs/server.hytopia.simplecharactercontroller.face.md +89 -0
- package/docs/server.hytopia.simplecharactercontroller.md +88 -0
- package/docs/server.hytopia.simplecharactercontroller.move.md +89 -0
- package/docs/server.md +77 -0
- package/docs/server.movecallback.md +15 -0
- package/docs/server.movecompletecallback.md +15 -0
- package/docs/server.moveoptions.md +23 -0
- package/docs/server.simplecharactercontroller.face.md +89 -0
- package/docs/server.simplecharactercontroller.md +88 -0
- package/docs/server.simplecharactercontroller.move.md +89 -0
- package/examples/entity-spawn/index.ts +1 -1
- package/examples/payload-game/index.ts +46 -104
- package/package.json +1 -1
- package/server.api.json +1048 -264
- package/server.d.ts +191 -51
- package/server.js +57 -57
- package/tsconfig.json +4 -1
- package/docs/server.basecharactercontroller.ontickpathfindingmovement.md +0 -13
- package/docs/server.basecharactercontroller.tickpathfindingmovement.md +0 -69
- package/docs/server.defaultcharactercontroller.tickpathfindingmovement.md +0 -69
- package/docs/server.hytopia.basecharactercontroller.ontickpathfindingmovement.md +0 -13
- package/docs/server.hytopia.basecharactercontroller.tickpathfindingmovement.md +0 -69
- package/docs/server.hytopia.defaultcharactercontroller.tickpathfindingmovement.md +0 -69
- package/examples/character-controller/tsconfig.json +0 -27
- package/examples/entity-spawn/tsconfig.json +0 -27
- package/examples/payload-game/tsconfig.json +0 -27
@@ -101,7 +101,7 @@ Description
|
|
101
101
|
|
102
102
|
</td><td>
|
103
103
|
|
104
|
-
(
|
104
|
+
(defaultCharacterController: [DefaultCharacterController](./server.defaultcharactercontroller.md)<!-- -->) => boolean
|
105
105
|
|
106
106
|
|
107
107
|
</td><td>
|
@@ -120,7 +120,7 @@ A function allowing custom logic to determine if the entity can jump.
|
|
120
120
|
|
121
121
|
</td><td>
|
122
122
|
|
123
|
-
(
|
123
|
+
(defaultCharacterController: [DefaultCharacterController](./server.defaultcharactercontroller.md)<!-- -->) => boolean
|
124
124
|
|
125
125
|
|
126
126
|
</td><td>
|
@@ -139,7 +139,7 @@ A function allowing custom logic to determine if the entity can run.
|
|
139
139
|
|
140
140
|
</td><td>
|
141
141
|
|
142
|
-
(
|
142
|
+
(defaultCharacterController: [DefaultCharacterController](./server.defaultcharactercontroller.md)<!-- -->) => boolean
|
143
143
|
|
144
144
|
|
145
145
|
</td><td>
|
@@ -301,20 +301,6 @@ Description
|
|
301
301
|
Creates the sensor colliders for the character controller, overriding the default implementation.
|
302
302
|
|
303
303
|
|
304
|
-
</td></tr>
|
305
|
-
<tr><td>
|
306
|
-
|
307
|
-
[tickPathfindingMovement(destination, deltaTimeMs)](./server.hytopia.defaultcharactercontroller.tickpathfindingmovement.md)
|
308
|
-
|
309
|
-
|
310
|
-
</td><td>
|
311
|
-
|
312
|
-
|
313
|
-
</td><td>
|
314
|
-
|
315
|
-
Ticks the pathfinding movement for the character controller, overriding the default implementation.
|
316
|
-
|
317
|
-
|
318
304
|
</td></tr>
|
319
305
|
<tr><td>
|
320
306
|
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
## HYTOPIA.Entity.createCustomCharacterController property
|
6
6
|
|
7
|
-
A function that creates a custom character controller for the entity.
|
7
|
+
A function that creates a custom character controller for the entity when it spawns.
|
8
8
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
createCustomCharacterController?: (
|
12
|
+
createCustomCharacterController?: (entity: Entity) => BaseCharacterController;
|
13
13
|
```
|
@@ -133,12 +133,12 @@ The character controller for the entity.
|
|
133
133
|
|
134
134
|
</td><td>
|
135
135
|
|
136
|
-
(
|
136
|
+
(entity: [Entity](./server.entity.md)<!-- -->) => [BaseCharacterController](./server.basecharactercontroller.md)
|
137
137
|
|
138
138
|
|
139
139
|
</td><td>
|
140
140
|
|
141
|
-
_(Optional)_ A function that creates a custom character controller for the entity.
|
141
|
+
_(Optional)_ A function that creates a custom character controller for the entity when it spawns.
|
142
142
|
|
143
143
|
|
144
144
|
</td></tr>
|
@@ -278,7 +278,7 @@ The name of the entity.
|
|
278
278
|
|
279
279
|
</td><td>
|
280
280
|
|
281
|
-
(
|
281
|
+
(entity: [Entity](./server.entity.md)<!-- -->, block: [BlockType](./server.blocktype.md)<!-- -->, started: boolean) => void
|
282
282
|
|
283
283
|
|
284
284
|
</td><td>
|
@@ -297,7 +297,7 @@ _(Optional)_ A function that is called when the entity collides with a block.
|
|
297
297
|
|
298
298
|
</td><td>
|
299
299
|
|
300
|
-
(
|
300
|
+
(entity: [Entity](./server.entity.md)<!-- -->, block: [BlockType](./server.blocktype.md)<!-- -->, contactForceData: ContactForceData) => void
|
301
301
|
|
302
302
|
|
303
303
|
</td><td>
|
@@ -316,7 +316,7 @@ _(Optional)_ A function that is called when the entity collides with a block.
|
|
316
316
|
|
317
317
|
</td><td>
|
318
318
|
|
319
|
-
(
|
319
|
+
(entity: [Entity](./server.entity.md)<!-- -->) => void
|
320
320
|
|
321
321
|
|
322
322
|
</td><td>
|
@@ -335,7 +335,7 @@ _(Optional)_ A function that is called when the entity is despawned.
|
|
335
335
|
|
336
336
|
</td><td>
|
337
337
|
|
338
|
-
(
|
338
|
+
(entity: [Entity](./server.entity.md)<!-- -->, otherEntity: [Entity](./server.entity.md)<!-- -->, started: boolean) => void
|
339
339
|
|
340
340
|
|
341
341
|
</td><td>
|
@@ -354,7 +354,7 @@ _(Optional)_ A function that is called when the entity collides with another ent
|
|
354
354
|
|
355
355
|
</td><td>
|
356
356
|
|
357
|
-
(
|
357
|
+
(entity: [Entity](./server.entity.md)<!-- -->, otherEntity: [Entity](./server.entity.md)<!-- -->, contactForceData: ContactForceData) => void
|
358
358
|
|
359
359
|
|
360
360
|
</td><td>
|
@@ -373,7 +373,7 @@ _(Optional)_ A function that is called when the entity contacts another entity.
|
|
373
373
|
|
374
374
|
</td><td>
|
375
375
|
|
376
|
-
(
|
376
|
+
(entity: [Entity](./server.entity.md)<!-- -->) => void
|
377
377
|
|
378
378
|
|
379
379
|
</td><td>
|
@@ -392,7 +392,7 @@ _(Optional)_ A function that is called when the entity is spawned.
|
|
392
392
|
|
393
393
|
</td><td>
|
394
394
|
|
395
|
-
(
|
395
|
+
(entity: [Entity](./server.entity.md)<!-- -->, tickDeltaMs: number) => void
|
396
396
|
|
397
397
|
|
398
398
|
</td><td>
|
@@ -9,5 +9,5 @@ A function that is called when the entity collides with a block.
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onBlockCollision?: (
|
12
|
+
onBlockCollision?: (entity: Entity, block: BlockType, started: boolean) => void;
|
13
13
|
```
|
@@ -9,5 +9,5 @@ A function that is called when the entity collides with a block.
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onBlockContactForce?: (
|
12
|
+
onBlockContactForce?: (entity: Entity, block: BlockType, contactForceData: ContactForceData) => void;
|
13
13
|
```
|
@@ -9,5 +9,5 @@ A function that is called when the entity collides with another entity.
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onEntityCollision?: (
|
12
|
+
onEntityCollision?: (entity: Entity, otherEntity: Entity, started: boolean) => void;
|
13
13
|
```
|
@@ -9,5 +9,5 @@ A function that is called when the entity contacts another entity.
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onEntityContactForce?: (
|
12
|
+
onEntityContactForce?: (entity: Entity, otherEntity: Entity, contactForceData: ContactForceData) => void;
|
13
13
|
```
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [EntityOptions](./server.hytopia.entityoptions.md) > [createCustomCharacterController](./server.hytopia.entityoptions.createcustomcharactercontroller.md)
|
4
|
+
|
5
|
+
## HYTOPIA.EntityOptions.createCustomCharacterController property
|
6
|
+
|
7
|
+
A function that creates a custom character controller for the entity when it spawns.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
createCustomCharacterController?: (entity: Entity) => BaseCharacterController;
|
13
|
+
```
|
@@ -37,6 +37,25 @@ Description
|
|
37
37
|
</th></tr></thead>
|
38
38
|
<tbody><tr><td>
|
39
39
|
|
40
|
+
[createCustomCharacterController?](./server.hytopia.entityoptions.createcustomcharactercontroller.md)
|
41
|
+
|
42
|
+
|
43
|
+
</td><td>
|
44
|
+
|
45
|
+
|
46
|
+
</td><td>
|
47
|
+
|
48
|
+
(entity: [Entity](./server.entity.md)<!-- -->) => [BaseCharacterController](./server.basecharactercontroller.md)
|
49
|
+
|
50
|
+
|
51
|
+
</td><td>
|
52
|
+
|
53
|
+
_(Optional)_ A function that creates a custom character controller for the entity when it spawns.
|
54
|
+
|
55
|
+
|
56
|
+
</td></tr>
|
57
|
+
<tr><td>
|
58
|
+
|
40
59
|
[modelLoopedAnimations?](./server.hytopia.entityoptions.modelloopedanimations.md)
|
41
60
|
|
42
61
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [FaceCallback](./server.hytopia.facecallback.md)
|
4
|
+
|
5
|
+
## HYTOPIA.FaceCallback type
|
6
|
+
|
7
|
+
A callback function called when the entity associated with the SimpleCharacterController updates its rotation as it is attempting to face a target coordinate.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export type FaceCallback = (currentRotation: Rotation, targetRotation: Rotation) => void;
|
13
|
+
```
|
14
|
+
**References:** [Rotation](./server.rotation.md)
|
15
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [FaceCompleteCallback](./server.hytopia.facecompletecallback.md)
|
4
|
+
|
5
|
+
## HYTOPIA.FaceCompleteCallback type
|
6
|
+
|
7
|
+
A callback function called when the entity associated with the SimpleCharacterController finishes rotating and is now facing a target coordinate.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export type FaceCompleteCallback = (endRotation: Rotation) => void;
|
13
|
+
```
|
14
|
+
**References:** [Rotation](./server.rotation.md)
|
15
|
+
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [FaceOptions](./server.hytopia.faceoptions.md)
|
4
|
+
|
5
|
+
## HYTOPIA.FaceOptions type
|
6
|
+
|
7
|
+
Options for the [SimpleCharacterController.face()](./server.simplecharactercontroller.face.md) method.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export type FaceOptions = {
|
13
|
+
faceCallback?: FaceCallback;
|
14
|
+
faceCompleteCallback?: FaceCompleteCallback;
|
15
|
+
};
|
16
|
+
```
|
17
|
+
**References:** [FaceCallback](./server.facecallback.md)<!-- -->, [FaceCompleteCallback](./server.facecompletecallback.md)
|
18
|
+
|
package/docs/server.hytopia.md
CHANGED
@@ -225,6 +225,17 @@ Manages all connected players in a game server.
|
|
225
225
|
Represents a rigid body in a world's physics simulation.
|
226
226
|
|
227
227
|
|
228
|
+
</td></tr>
|
229
|
+
<tr><td>
|
230
|
+
|
231
|
+
[SimpleCharacterController](./server.hytopia.simplecharactercontroller.md)
|
232
|
+
|
233
|
+
|
234
|
+
</td><td>
|
235
|
+
|
236
|
+
A simple character controller with basic movement functions.
|
237
|
+
|
238
|
+
|
228
239
|
</td></tr>
|
229
240
|
<tr><td>
|
230
241
|
|
@@ -836,6 +847,72 @@ A callback function for a chat command.
|
|
836
847
|
A decoded set of collision groups represented as their string equivalents.
|
837
848
|
|
838
849
|
|
850
|
+
</td></tr>
|
851
|
+
<tr><td>
|
852
|
+
|
853
|
+
[FaceCallback](./server.hytopia.facecallback.md)
|
854
|
+
|
855
|
+
|
856
|
+
</td><td>
|
857
|
+
|
858
|
+
A callback function called when the entity associated with the SimpleCharacterController updates its rotation as it is attempting to face a target coordinate.
|
859
|
+
|
860
|
+
|
861
|
+
</td></tr>
|
862
|
+
<tr><td>
|
863
|
+
|
864
|
+
[FaceCompleteCallback](./server.hytopia.facecompletecallback.md)
|
865
|
+
|
866
|
+
|
867
|
+
</td><td>
|
868
|
+
|
869
|
+
A callback function called when the entity associated with the SimpleCharacterController finishes rotating and is now facing a target coordinate.
|
870
|
+
|
871
|
+
|
872
|
+
</td></tr>
|
873
|
+
<tr><td>
|
874
|
+
|
875
|
+
[FaceOptions](./server.hytopia.faceoptions.md)
|
876
|
+
|
877
|
+
|
878
|
+
</td><td>
|
879
|
+
|
880
|
+
Options for the [SimpleCharacterController.face()](./server.simplecharactercontroller.face.md) method.
|
881
|
+
|
882
|
+
|
883
|
+
</td></tr>
|
884
|
+
<tr><td>
|
885
|
+
|
886
|
+
[MoveCallback](./server.hytopia.movecallback.md)
|
887
|
+
|
888
|
+
|
889
|
+
</td><td>
|
890
|
+
|
891
|
+
A callback function called when the entity associated with the SimpleCharacterController updates its translation as it is attempting to move to a target coordinate.
|
892
|
+
|
893
|
+
|
894
|
+
</td></tr>
|
895
|
+
<tr><td>
|
896
|
+
|
897
|
+
[MoveCompleteCallback](./server.hytopia.movecompletecallback.md)
|
898
|
+
|
899
|
+
|
900
|
+
</td><td>
|
901
|
+
|
902
|
+
A callback function called when the entity associated with the SimpleCharacterController reaches the target coordinate. An entity must reach the x,y,z coordinate for the callback to be called.
|
903
|
+
|
904
|
+
|
905
|
+
</td></tr>
|
906
|
+
<tr><td>
|
907
|
+
|
908
|
+
[MoveOptions](./server.hytopia.moveoptions.md)
|
909
|
+
|
910
|
+
|
911
|
+
</td><td>
|
912
|
+
|
913
|
+
Options for the [SimpleCharacterController.move()](./server.simplecharactercontroller.move.md) method.
|
914
|
+
|
915
|
+
|
839
916
|
</td></tr>
|
840
917
|
<tr><td>
|
841
918
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [MoveCallback](./server.hytopia.movecallback.md)
|
4
|
+
|
5
|
+
## HYTOPIA.MoveCallback type
|
6
|
+
|
7
|
+
A callback function called when the entity associated with the SimpleCharacterController updates its translation as it is attempting to move to a target coordinate.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export type MoveCallback = (currentTranslation: Vector3, targetTranslation: Vector3) => void;
|
13
|
+
```
|
14
|
+
**References:** [Vector3](./server.vector3.md)
|
15
|
+
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [MoveCompleteCallback](./server.hytopia.movecompletecallback.md)
|
4
|
+
|
5
|
+
## HYTOPIA.MoveCompleteCallback type
|
6
|
+
|
7
|
+
A callback function called when the entity associated with the SimpleCharacterController reaches the target coordinate. An entity must reach the x,y,z coordinate for the callback to be called.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export type MoveCompleteCallback = (endTranslation: Vector3) => void;
|
13
|
+
```
|
14
|
+
**References:** [Vector3](./server.vector3.md)
|
15
|
+
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [MoveOptions](./server.hytopia.moveoptions.md)
|
4
|
+
|
5
|
+
## HYTOPIA.MoveOptions type
|
6
|
+
|
7
|
+
Options for the [SimpleCharacterController.move()](./server.simplecharactercontroller.move.md) method.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export type MoveOptions = {
|
13
|
+
moveCallback?: MoveCallback;
|
14
|
+
moveCompleteCallback?: MoveCompleteCallback;
|
15
|
+
moveIgnoreAxes?: {
|
16
|
+
x?: boolean;
|
17
|
+
y?: boolean;
|
18
|
+
z?: boolean;
|
19
|
+
};
|
20
|
+
};
|
21
|
+
```
|
22
|
+
**References:** [MoveCallback](./server.movecallback.md)<!-- -->, [MoveCompleteCallback](./server.movecompletecallback.md)
|
23
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [SimpleCharacterController](./server.hytopia.simplecharactercontroller.md) > [face](./server.hytopia.simplecharactercontroller.face.md)
|
4
|
+
|
5
|
+
## HYTOPIA.SimpleCharacterController.face() method
|
6
|
+
|
7
|
+
Rotates the entity at a given speed to face a target coordinate.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
face(target: Vector3, speed: number, options?: FaceOptions): void;
|
13
|
+
```
|
14
|
+
|
15
|
+
## Parameters
|
16
|
+
|
17
|
+
<table><thead><tr><th>
|
18
|
+
|
19
|
+
Parameter
|
20
|
+
|
21
|
+
|
22
|
+
</th><th>
|
23
|
+
|
24
|
+
Type
|
25
|
+
|
26
|
+
|
27
|
+
</th><th>
|
28
|
+
|
29
|
+
Description
|
30
|
+
|
31
|
+
|
32
|
+
</th></tr></thead>
|
33
|
+
<tbody><tr><td>
|
34
|
+
|
35
|
+
target
|
36
|
+
|
37
|
+
|
38
|
+
</td><td>
|
39
|
+
|
40
|
+
[Vector3](./server.vector3.md)
|
41
|
+
|
42
|
+
|
43
|
+
</td><td>
|
44
|
+
|
45
|
+
The target coordinate to face.
|
46
|
+
|
47
|
+
|
48
|
+
</td></tr>
|
49
|
+
<tr><td>
|
50
|
+
|
51
|
+
speed
|
52
|
+
|
53
|
+
|
54
|
+
</td><td>
|
55
|
+
|
56
|
+
number
|
57
|
+
|
58
|
+
|
59
|
+
</td><td>
|
60
|
+
|
61
|
+
The speed at which to rotate to the target coordinate.
|
62
|
+
|
63
|
+
|
64
|
+
</td></tr>
|
65
|
+
<tr><td>
|
66
|
+
|
67
|
+
options
|
68
|
+
|
69
|
+
|
70
|
+
</td><td>
|
71
|
+
|
72
|
+
[FaceOptions](./server.faceoptions.md)
|
73
|
+
|
74
|
+
|
75
|
+
</td><td>
|
76
|
+
|
77
|
+
_(Optional)_ Additional options for the face operation, such as callbacks.
|
78
|
+
|
79
|
+
|
80
|
+
</td></tr>
|
81
|
+
</tbody></table>
|
82
|
+
**Returns:**
|
83
|
+
|
84
|
+
void
|
85
|
+
|
86
|
+
## Remarks
|
87
|
+
|
88
|
+
If this method is called while the entity is already attempting to face another target, the previous target will be ignored and the entity will start attempting to face the new target.
|
89
|
+
|
@@ -0,0 +1,88 @@
|
|
1
|
+
<!-- Do not edit this file. It is automatically generated by API Documenter. -->
|
2
|
+
|
3
|
+
[Home](./index.md) > [server](./server.md) > [HYTOPIA](./server.hytopia.md) > [SimpleCharacterController](./server.hytopia.simplecharactercontroller.md)
|
4
|
+
|
5
|
+
## HYTOPIA.SimpleCharacterController class
|
6
|
+
|
7
|
+
A simple character controller with basic movement functions.
|
8
|
+
|
9
|
+
**Signature:**
|
10
|
+
|
11
|
+
```typescript
|
12
|
+
export default class SimpleCharacterController extends BaseCharacterController
|
13
|
+
```
|
14
|
+
**Extends:** [BaseCharacterController](./server.basecharactercontroller.md)
|
15
|
+
|
16
|
+
## Remarks
|
17
|
+
|
18
|
+
This class implements simple movement methods that serve as a way to add realistic movement and rotational facing functionality to an entity. This is also a great base to extend for your own more complex character controller that implements things like pathfinding. Compatible with entities that have kinematic or dynamic rigid body types.
|
19
|
+
|
20
|
+
## Example
|
21
|
+
|
22
|
+
|
23
|
+
```typescript
|
24
|
+
// Create a custom character controller for myEntity, prior to spawning it.
|
25
|
+
myEntity.createCustomCharacterController = () => {
|
26
|
+
return new SimpleCharacterController(myEntity);
|
27
|
+
};
|
28
|
+
|
29
|
+
// Spawn the entity in the world.
|
30
|
+
myEntity.spawn(world, { x: 53, y: 10, z: 23 });
|
31
|
+
|
32
|
+
// Move the entity at a speed of 4 blocks
|
33
|
+
// per second to the coordinate (10, 1, 10).
|
34
|
+
// console.log when we reach the target.
|
35
|
+
myEntity.characterController.move({ x: 10, y: 1, z: 10 }, 4, {
|
36
|
+
moveCompleteCallback: endPosition => {
|
37
|
+
console.log('Finished moving to', endPosition);
|
38
|
+
},
|
39
|
+
});
|
40
|
+
```
|
41
|
+
|
42
|
+
## Methods
|
43
|
+
|
44
|
+
<table><thead><tr><th>
|
45
|
+
|
46
|
+
Method
|
47
|
+
|
48
|
+
|
49
|
+
</th><th>
|
50
|
+
|
51
|
+
Modifiers
|
52
|
+
|
53
|
+
|
54
|
+
</th><th>
|
55
|
+
|
56
|
+
Description
|
57
|
+
|
58
|
+
|
59
|
+
</th></tr></thead>
|
60
|
+
<tbody><tr><td>
|
61
|
+
|
62
|
+
[face(target, speed, options)](./server.hytopia.simplecharactercontroller.face.md)
|
63
|
+
|
64
|
+
|
65
|
+
</td><td>
|
66
|
+
|
67
|
+
|
68
|
+
</td><td>
|
69
|
+
|
70
|
+
Rotates the entity at a given speed to face a target coordinate.
|
71
|
+
|
72
|
+
|
73
|
+
</td></tr>
|
74
|
+
<tr><td>
|
75
|
+
|
76
|
+
[move(target, speed, options)](./server.hytopia.simplecharactercontroller.move.md)
|
77
|
+
|
78
|
+
|
79
|
+
</td><td>
|
80
|
+
|
81
|
+
|
82
|
+
</td><td>
|
83
|
+
|
84
|
+
Moves the entity at a given speed in a straight line to a target coordinate.
|
85
|
+
|
86
|
+
|
87
|
+
</td></tr>
|
88
|
+
</tbody></table>
|