hytopia 0.1.29 → 0.1.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -26
- package/bin/scripts.js +15 -8
- 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 -3
- 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.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 -3
- 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.moveoptions.md +5 -0
- package/docs/server.hytopia.simplecharactercontroller.md +1 -1
- package/docs/server.moveoptions.md +5 -0
- package/docs/server.simplecharactercontroller.md +1 -1
- 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 +142 -60
- package/server.d.ts +51 -33
- package/server.js +25 -25
- package/tsconfig.json +4 -1
- package/examples/character-controller/package.json +0 -14
- package/examples/character-controller/tsconfig.json +0 -27
- package/examples/entity-spawn/package.json +0 -14
- package/examples/entity-spawn/tsconfig.json +0 -27
- package/examples/payload-game/package.json +0 -14
- package/examples/payload-game/tsconfig.json +0 -27
package/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# HYTOPIA SDK
|
2
2
|
|
3
3
|
## Quick Links
|
4
|
-
[Quickstart](#quickstart) • [Developer Docs](https://dev.hytopia.com/) • [API Reference](./docs/server.md) • [Examples](./examples) • [Join Our Developer Discord](https://discord.gg/hytopia-developers) • [Report Bugs or Request Features](https://github.com/hytopiagg/sdk/issues)
|
4
|
+
[Quickstart (Start Here)](#quickstart-start-here) • [Developer Docs](https://dev.hytopia.com/) • [API Reference](./docs/server.md) • [Examples](./examples) • [Join Our Developer Discord](https://discord.gg/hytopia-developers) • [Report Bugs or Request Features](https://github.com/hytopiagg/sdk/issues)
|
5
5
|
|
6
6
|
## What is HYTOPIA?
|
7
7
|
|
@@ -28,32 +28,9 @@ Available as a simple NPM package, this SDK provides everything you need to get
|
|
28
28
|
|
29
29
|
With these resources, you can quickly build and share immersive, voxel-style multiplayer games on HYTOPIA.
|
30
30
|
|
31
|
-
## Quickstart
|
31
|
+
## Quickstart (Start Here)
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
2. Create a new project directory somewhere on your machine and navigate into it.
|
36
|
-
```bash
|
37
|
-
mkdir my-project-directory && cd my-project-directory
|
38
|
-
```
|
39
|
-
|
40
|
-
3. Initialize a hytopia project from boilerplate or an existing example. Sets up package.json and all dependencies, copies assets and an index.ts game script into your project.
|
41
|
-
```bash
|
42
|
-
# Option 1: Initialize a boilerplate project
|
43
|
-
bunx hytopia init
|
44
|
-
|
45
|
-
# Option 2: Initialize a project from any of the examples in the examples directory like so:
|
46
|
-
bunx hytopia init --template payload-game
|
47
|
-
```
|
48
|
-
|
49
|
-
3. Start the server, use --watch for hot reloads as you make changes.
|
50
|
-
```bash
|
51
|
-
bun --watch index.ts
|
52
|
-
```
|
53
|
-
|
54
|
-
4. Visit https://play.hytopia.com - when prompted, enter `localhost:8080` - this is the hostname of the local server you started in the previous step.
|
55
|
-
|
56
|
-
**Note: If you'd prefer to use JavaScript instead of TypeScript, simply change the file extension of index.ts to index.js - Your editor will highlight the TypeScript syntax errors, simple delete the type annotations and everything should work the same without any TypeScript usage.**
|
33
|
+
**[Follow the Initial Setup guide, here](https://dev.hytopia.com/getting-started/initial-setup).**
|
57
34
|
|
58
35
|
Once you're up and running, here's some other resources to go further:
|
59
36
|
- [Developer Docs](https://dev.hytopia.com/)
|
package/bin/scripts.js
CHANGED
@@ -27,30 +27,37 @@ const path = require('path');
|
|
27
27
|
if (command === 'init') {
|
28
28
|
const destDir = process.cwd();
|
29
29
|
|
30
|
+
// Initialize project with latest HYTOPIA SDK
|
31
|
+
console.log('🔧 Initializing project with latest HYTOPIA SDK...');
|
32
|
+
execSync('bun init --yes');
|
33
|
+
execSync('bun add hytopia@latest');
|
34
|
+
|
30
35
|
if (flags.template) {
|
31
|
-
|
36
|
+
// Init from example template
|
37
|
+
console.log(`🖨️ Initializing project with examples template "${flags.template}"...`);
|
32
38
|
|
33
|
-
const templateDir = path.join(
|
39
|
+
const templateDir = path.join(destDir, 'node_modules', 'hytopia', 'examples', flags.template);
|
34
40
|
|
35
41
|
if (!fs.existsSync(templateDir)) {
|
36
|
-
console.error(`Examples template ${flags.template} does not exist in the examples directory, could not initialize project
|
42
|
+
console.error(`Examples template ${flags.template} does not exist in the examples directory, could not initialize project! Tried directory: ${templateDir}`);
|
37
43
|
return;
|
38
44
|
}
|
39
45
|
|
40
46
|
fs.cpSync(templateDir, destDir, { recursive: true });
|
41
|
-
execSync('bun install');
|
42
47
|
} else {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
48
|
+
// Init from boilerplate
|
49
|
+
console.log('🧑💻 Initializing project with boilerplate...');
|
50
|
+
|
47
51
|
const srcDir = path.join(__dirname, '..', 'boilerplate');
|
52
|
+
|
48
53
|
fs.cpSync(srcDir, destDir, { recursive: true });
|
49
54
|
}
|
50
55
|
|
51
56
|
// Done, lfg!
|
57
|
+
console.log('--------------------------------');
|
52
58
|
console.log('🚀 Hytopia project initialized successfully!');
|
53
59
|
console.log('💡 Start your development server with `bun --watch index.ts`!');
|
60
|
+
console.log('🎮 After you start your development server, play by opening your browser and visiting: https://play.hytopia.com/?join=localhost:8080')
|
54
61
|
return;
|
55
62
|
}
|
56
63
|
|
package/docs/server.blocktype.md
CHANGED
@@ -183,7 +183,7 @@ The name of the block type.
|
|
183
183
|
|
184
184
|
</td><td>
|
185
185
|
|
186
|
-
(
|
186
|
+
(blockType: [BlockType](./server.blocktype.md)<!-- -->, entity: [Entity](./server.entity.md)<!-- -->, started: boolean) => void
|
187
187
|
|
188
188
|
|
189
189
|
</td><td>
|
@@ -202,7 +202,7 @@ _(Optional)_ A callback function that is invoked when an entity collides with bl
|
|
202
202
|
|
203
203
|
</td><td>
|
204
204
|
|
205
|
-
(
|
205
|
+
(blockType: [BlockType](./server.blocktype.md)<!-- -->, entity: [Entity](./server.entity.md)<!-- -->, contactForceData: ContactForceData) => void
|
206
206
|
|
207
207
|
|
208
208
|
</td><td>
|
@@ -9,5 +9,5 @@ A callback function that is invoked when an entity collides with blocks of this
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onEntityCollision?: (
|
12
|
+
onEntityCollision?: (blockType: BlockType, entity: Entity, started: boolean) => void;
|
13
13
|
```
|
@@ -9,5 +9,5 @@ A callback function that is invoked when an entity contacts a block of this type
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onEntityContactForce?: (
|
12
|
+
onEntityContactForce?: (blockType: BlockType, entity: Entity, contactForceData: ContactForceData) => void;
|
13
13
|
```
|
@@ -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>
|
@@ -4,10 +4,10 @@
|
|
4
4
|
|
5
5
|
## 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
|
```
|
package/docs/server.entity.md
CHANGED
@@ -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) > [EntityOptions](./server.entityoptions.md) > [createCustomCharacterController](./server.entityoptions.createcustomcharactercontroller.md)
|
4
|
+
|
5
|
+
## 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.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.entityoptions.modelloopedanimations.md)
|
41
60
|
|
42
61
|
|
@@ -183,7 +183,7 @@ The name of the block type.
|
|
183
183
|
|
184
184
|
</td><td>
|
185
185
|
|
186
|
-
(
|
186
|
+
(blockType: [BlockType](./server.blocktype.md)<!-- -->, entity: [Entity](./server.entity.md)<!-- -->, started: boolean) => void
|
187
187
|
|
188
188
|
|
189
189
|
</td><td>
|
@@ -202,7 +202,7 @@ _(Optional)_ A callback function that is invoked when an entity collides with bl
|
|
202
202
|
|
203
203
|
</td><td>
|
204
204
|
|
205
|
-
(
|
205
|
+
(blockType: [BlockType](./server.blocktype.md)<!-- -->, entity: [Entity](./server.entity.md)<!-- -->, contactForceData: ContactForceData) => void
|
206
206
|
|
207
207
|
|
208
208
|
</td><td>
|
@@ -9,5 +9,5 @@ A callback function that is invoked when an entity collides with blocks of this
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onEntityCollision?: (
|
12
|
+
onEntityCollision?: (blockType: BlockType, entity: Entity, started: boolean) => void;
|
13
13
|
```
|
@@ -9,5 +9,5 @@ A callback function that is invoked when an entity contacts a block of this type
|
|
9
9
|
**Signature:**
|
10
10
|
|
11
11
|
```typescript
|
12
|
-
onEntityContactForce?: (
|
12
|
+
onEntityContactForce?: (blockType: BlockType, entity: Entity, contactForceData: ContactForceData) => void;
|
13
13
|
```
|
@@ -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>
|
@@ -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
|
|