@directivegames/genesys.sdk 3.2.2
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 +60 -0
- package/dist/src/asset-pack/eslint.config.js +43 -0
- package/dist/src/asset-pack/scripts/postinstall.js +64 -0
- package/dist/src/asset-pack/src/index.js +1 -0
- package/dist/src/core/cli.js +306 -0
- package/dist/src/core/common.js +324 -0
- package/dist/src/core/index.js +6 -0
- package/dist/src/core/tools/build-project.js +450 -0
- package/dist/src/core/tools/index.js +2 -0
- package/dist/src/core/tools/new-asset-pack.js +150 -0
- package/dist/src/core/tools/new-project.js +292 -0
- package/dist/src/core/types.js +1 -0
- package/dist/src/dependencies.js +82 -0
- package/dist/src/electron/IpcSerializableError.js +38 -0
- package/dist/src/electron/api.js +7 -0
- package/dist/src/electron/backend/actions.js +56 -0
- package/dist/src/electron/backend/handler.js +441 -0
- package/dist/src/electron/backend/logging.js +41 -0
- package/dist/src/electron/backend/main.js +315 -0
- package/dist/src/electron/backend/menu.js +208 -0
- package/dist/src/electron/backend/state.js +201 -0
- package/dist/src/electron/backend/tools/const.js +9 -0
- package/dist/src/electron/backend/tools/file-server.js +383 -0
- package/dist/src/electron/backend/tools/open-project.js +261 -0
- package/dist/src/electron/backend/window.js +161 -0
- package/dist/src/templates/eslint.config.js +43 -0
- package/dist/src/templates/scripts/genesys/build-project.js +42 -0
- package/dist/src/templates/scripts/genesys/calc-bounding-box.js +205 -0
- package/dist/src/templates/scripts/genesys/common.js +36 -0
- package/dist/src/templates/scripts/genesys/const.js +9 -0
- package/dist/src/templates/scripts/genesys/dev/dump-default-scene.js +8 -0
- package/dist/src/templates/scripts/genesys/dev/generate-manifest.js +116 -0
- package/dist/src/templates/scripts/genesys/dev/launcher.js +39 -0
- package/dist/src/templates/scripts/genesys/dev/storage-provider.js +188 -0
- package/dist/src/templates/scripts/genesys/dev/update-template-scenes.js +67 -0
- package/dist/src/templates/scripts/genesys/doc-server.js +12 -0
- package/dist/src/templates/scripts/genesys/genesys-mcp.js +413 -0
- package/dist/src/templates/scripts/genesys/mcp/doc-tools.js +70 -0
- package/dist/src/templates/scripts/genesys/mcp/editor-functions.js +123 -0
- package/dist/src/templates/scripts/genesys/mcp/editor-tools.js +51 -0
- package/dist/src/templates/scripts/genesys/mcp/get-scene-state.js +26 -0
- package/dist/src/templates/scripts/genesys/mcp/run-subprocess.js +23 -0
- package/dist/src/templates/scripts/genesys/mcp/search-actors.js +703 -0
- package/dist/src/templates/scripts/genesys/mcp/search-assets.js +296 -0
- package/dist/src/templates/scripts/genesys/mcp/utils.js +234 -0
- package/dist/src/templates/scripts/genesys/misc.js +32 -0
- package/dist/src/templates/scripts/genesys/mock.js +5 -0
- package/dist/src/templates/scripts/genesys/place-actors.js +112 -0
- package/dist/src/templates/scripts/genesys/post-install.js +25 -0
- package/dist/src/templates/scripts/genesys/remove-engine-comments.js +113 -0
- package/dist/src/templates/scripts/genesys/storageProvider.js +146 -0
- package/dist/src/templates/scripts/genesys/validate-prefabs.js +115 -0
- package/dist/src/templates/src/index.js +20 -0
- package/dist/src/templates/src/templates/firstPerson/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/firstPerson/src/game.js +30 -0
- package/dist/src/templates/src/templates/firstPerson/src/player.js +60 -0
- package/dist/src/templates/src/templates/fps/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/fps/src/game.js +30 -0
- package/dist/src/templates/src/templates/fps/src/player.js +64 -0
- package/dist/src/templates/src/templates/fps/src/weapon.js +62 -0
- package/dist/src/templates/src/templates/freeCamera/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/freeCamera/src/game.js +30 -0
- package/dist/src/templates/src/templates/freeCamera/src/player.js +43 -0
- package/dist/src/templates/src/templates/sideScroller/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/sideScroller/src/const.js +43 -0
- package/dist/src/templates/src/templates/sideScroller/src/game.js +103 -0
- package/dist/src/templates/src/templates/sideScroller/src/level-generator.js +249 -0
- package/dist/src/templates/src/templates/sideScroller/src/player.js +105 -0
- package/dist/src/templates/src/templates/thirdPerson/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/thirdPerson/src/game.js +30 -0
- package/dist/src/templates/src/templates/thirdPerson/src/player.js +63 -0
- package/dist/src/templates/src/templates/vehicle/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/vehicle/src/base-vehicle.js +122 -0
- package/dist/src/templates/src/templates/vehicle/src/game.js +33 -0
- package/dist/src/templates/src/templates/vehicle/src/mesh-vehicle.js +189 -0
- package/dist/src/templates/src/templates/vehicle/src/player.js +102 -0
- package/dist/src/templates/src/templates/vehicle/src/primitive-vehicle.js +259 -0
- package/dist/src/templates/src/templates/vehicle/src/ui-hints.js +100 -0
- package/dist/src/templates/src/templates/vr-game/src/auto-imports.js +1 -0
- package/dist/src/templates/src/templates/vr-game/src/game.js +55 -0
- package/dist/src/templates/src/templates/vr-game/src/sample-vr-actor.js +29 -0
- package/dist/src/templates/vite.config.js +46 -0
- package/package.json +176 -0
- package/scripts/post-install.ts +143 -0
- package/src/asset-pack/.gitattributes +89 -0
- package/src/asset-pack/eslint.config.js +45 -0
- package/src/asset-pack/gitignore +11 -0
- package/src/asset-pack/scripts/postinstall.ts +81 -0
- package/src/asset-pack/src/index.ts +0 -0
- package/src/asset-pack/tsconfig.json +34 -0
- package/src/templates/.cursor/mcp.json +20 -0
- package/src/templates/.cursorignore +2 -0
- package/src/templates/.gitattributes +89 -0
- package/src/templates/.vscode/settings.json +6 -0
- package/src/templates/AGENTS.md +86 -0
- package/src/templates/CLAUDE.md +1 -0
- package/src/templates/README.md +24 -0
- package/src/templates/eslint.config.js +45 -0
- package/src/templates/gitignore +11 -0
- package/src/templates/index.html +34 -0
- package/src/templates/pnpm-lock.yaml +3676 -0
- package/src/templates/scripts/genesys/build-project.ts +51 -0
- package/src/templates/scripts/genesys/calc-bounding-box.ts +272 -0
- package/src/templates/scripts/genesys/common.ts +46 -0
- package/src/templates/scripts/genesys/const.ts +9 -0
- package/src/templates/scripts/genesys/dev/dump-default-scene.ts +11 -0
- package/src/templates/scripts/genesys/dev/generate-manifest.ts +146 -0
- package/src/templates/scripts/genesys/dev/launcher.ts +46 -0
- package/src/templates/scripts/genesys/dev/storage-provider.ts +229 -0
- package/src/templates/scripts/genesys/dev/update-template-scenes.ts +84 -0
- package/src/templates/scripts/genesys/doc-server.ts +16 -0
- package/src/templates/scripts/genesys/genesys-mcp.ts +526 -0
- package/src/templates/scripts/genesys/mcp/doc-tools.ts +86 -0
- package/src/templates/scripts/genesys/mcp/editor-functions.ts +151 -0
- package/src/templates/scripts/genesys/mcp/editor-tools.ts +73 -0
- package/src/templates/scripts/genesys/mcp/get-scene-state.ts +35 -0
- package/src/templates/scripts/genesys/mcp/run-subprocess.ts +30 -0
- package/src/templates/scripts/genesys/mcp/search-actors.ts +858 -0
- package/src/templates/scripts/genesys/mcp/search-assets.ts +380 -0
- package/src/templates/scripts/genesys/mcp/utils.ts +281 -0
- package/src/templates/scripts/genesys/misc.ts +42 -0
- package/src/templates/scripts/genesys/mock.ts +6 -0
- package/src/templates/scripts/genesys/place-actors.ts +179 -0
- package/src/templates/scripts/genesys/post-install.ts +30 -0
- package/src/templates/scripts/genesys/prefab.schema.json +85 -0
- package/src/templates/scripts/genesys/remove-engine-comments.ts +135 -0
- package/src/templates/scripts/genesys/run-mcp-inspector.bat +5 -0
- package/src/templates/scripts/genesys/storageProvider.ts +182 -0
- package/src/templates/scripts/genesys/validate-prefabs.ts +138 -0
- package/src/templates/src/index.ts +22 -0
- package/src/templates/src/templates/firstPerson/assets/default.genesys-scene +166 -0
- package/src/templates/src/templates/firstPerson/src/auto-imports.ts +0 -0
- package/src/templates/src/templates/firstPerson/src/game.ts +39 -0
- package/src/templates/src/templates/firstPerson/src/player.ts +63 -0
- package/src/templates/src/templates/fps/assets/default.genesys-scene +9460 -0
- package/src/templates/src/templates/fps/assets/models/SM_Beam_400.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_ChamferCube.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Floor_Thick_400x400.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Floor_Thick_400x400_Orange.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Floor_Thin_400x400.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Floor_Thin_400x400_Orange.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Ramp_400x400.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Rifle.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x200.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x200_Orange.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x400.glb +0 -0
- package/src/templates/src/templates/fps/assets/models/SM_Wall_Thin_400x400_Orange.glb +0 -0
- package/src/templates/src/templates/fps/src/auto-imports.ts +0 -0
- package/src/templates/src/templates/fps/src/game.ts +39 -0
- package/src/templates/src/templates/fps/src/player.ts +69 -0
- package/src/templates/src/templates/fps/src/weapon.ts +54 -0
- package/src/templates/src/templates/freeCamera/assets/default.genesys-scene +166 -0
- package/src/templates/src/templates/freeCamera/src/auto-imports.ts +0 -0
- package/src/templates/src/templates/freeCamera/src/game.ts +39 -0
- package/src/templates/src/templates/freeCamera/src/player.ts +45 -0
- package/src/templates/src/templates/sideScroller/assets/default.genesys-scene +122 -0
- package/src/templates/src/templates/sideScroller/src/auto-imports.ts +0 -0
- package/src/templates/src/templates/sideScroller/src/const.ts +46 -0
- package/src/templates/src/templates/sideScroller/src/game.ts +122 -0
- package/src/templates/src/templates/sideScroller/src/level-generator.ts +361 -0
- package/src/templates/src/templates/sideScroller/src/player.ts +125 -0
- package/src/templates/src/templates/thirdPerson/assets/default.genesys-scene +166 -0
- package/src/templates/src/templates/thirdPerson/src/auto-imports.ts +0 -0
- package/src/templates/src/templates/thirdPerson/src/game.ts +39 -0
- package/src/templates/src/templates/thirdPerson/src/player.ts +61 -0
- package/src/templates/src/templates/vehicle/assets/default.genesys-scene +226 -0
- package/src/templates/src/templates/vehicle/assets/models/cyberTruck/chassis.glb +0 -0
- package/src/templates/src/templates/vehicle/assets/models/cyberTruck/wheel.glb +0 -0
- package/src/templates/src/templates/vehicle/src/auto-imports.ts +0 -0
- package/src/templates/src/templates/vehicle/src/base-vehicle.ts +145 -0
- package/src/templates/src/templates/vehicle/src/game.ts +43 -0
- package/src/templates/src/templates/vehicle/src/mesh-vehicle.ts +191 -0
- package/src/templates/src/templates/vehicle/src/player.ts +109 -0
- package/src/templates/src/templates/vehicle/src/primitive-vehicle.ts +266 -0
- package/src/templates/src/templates/vehicle/src/ui-hints.ts +101 -0
- package/src/templates/src/templates/vr-game/assets/default.genesys-scene +247 -0
- package/src/templates/src/templates/vr-game/src/auto-imports.ts +1 -0
- package/src/templates/src/templates/vr-game/src/game.ts +66 -0
- package/src/templates/src/templates/vr-game/src/sample-vr-actor.ts +26 -0
- package/src/templates/tsconfig.json +35 -0
- package/src/templates/vite.config.ts +52 -0
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$version": 0,
|
|
3
|
+
"class": "ENGINE.World",
|
|
4
|
+
"uuid": "c0ae85792bc3b946",
|
|
5
|
+
"ctor": {
|
|
6
|
+
"backgroundColor": "#2E2E2E",
|
|
7
|
+
"navigationOptions": {
|
|
8
|
+
"engine": "recast-navigation",
|
|
9
|
+
"debug": false,
|
|
10
|
+
"generateOnStartUp": false
|
|
11
|
+
},
|
|
12
|
+
"physicsOptions": {
|
|
13
|
+
"gravity": [
|
|
14
|
+
0,
|
|
15
|
+
-9.81,
|
|
16
|
+
0,
|
|
17
|
+
"v"
|
|
18
|
+
],
|
|
19
|
+
"engine": "rapier"
|
|
20
|
+
},
|
|
21
|
+
"useManifold": true
|
|
22
|
+
},
|
|
23
|
+
"actors": [
|
|
24
|
+
{
|
|
25
|
+
"uuid": "9a86d389088b361c",
|
|
26
|
+
"class": "ENGINE.Actor",
|
|
27
|
+
"properties": {
|
|
28
|
+
"editorData": {
|
|
29
|
+
"displayName": "Directional Light",
|
|
30
|
+
"hidden": false
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"ctor": {
|
|
34
|
+
"rootComponent": {
|
|
35
|
+
"class": "ENGINE.DirectionalLightComponent",
|
|
36
|
+
"uuid": "cfe05433-9edc-4dfe-a535-c71f33e92d78",
|
|
37
|
+
"ctor": {
|
|
38
|
+
"color": 16777215,
|
|
39
|
+
"intensity": 1,
|
|
40
|
+
"castShadow": true,
|
|
41
|
+
"shadowMapSize": 2048,
|
|
42
|
+
"shadowBias": 0,
|
|
43
|
+
"shadowNormalBias": 0,
|
|
44
|
+
"shadowNear": 0.1,
|
|
45
|
+
"shadowFar": 100
|
|
46
|
+
},
|
|
47
|
+
"properties": {
|
|
48
|
+
"position": [
|
|
49
|
+
10,
|
|
50
|
+
50,
|
|
51
|
+
-10,
|
|
52
|
+
"v"
|
|
53
|
+
],
|
|
54
|
+
"castShadow": true
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"uuid": "9d428f2a16e5374a",
|
|
61
|
+
"class": "ENGINE.Actor",
|
|
62
|
+
"properties": {
|
|
63
|
+
"editorData": {
|
|
64
|
+
"displayName": "Ground",
|
|
65
|
+
"hidden": false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"ctor": {
|
|
69
|
+
"rootComponent": {
|
|
70
|
+
"class": "ENGINE.MeshComponent",
|
|
71
|
+
"uuid": "71caea24-62d7-4e45-a76e-4c7519de2c3c",
|
|
72
|
+
"ctor": {
|
|
73
|
+
"geometry": {
|
|
74
|
+
"class": "THREE.BoxGeometry",
|
|
75
|
+
"ctor": [
|
|
76
|
+
500,
|
|
77
|
+
0.1,
|
|
78
|
+
500
|
|
79
|
+
]
|
|
80
|
+
},
|
|
81
|
+
"material": {
|
|
82
|
+
"@external": "DefaultMaterial"
|
|
83
|
+
},
|
|
84
|
+
"uvScaleTilesPerUnit": 0.2
|
|
85
|
+
},
|
|
86
|
+
"properties": {
|
|
87
|
+
"position": [
|
|
88
|
+
0,
|
|
89
|
+
-0.9,
|
|
90
|
+
0,
|
|
91
|
+
"v"
|
|
92
|
+
],
|
|
93
|
+
"receiveShadow": true
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"uuid": "b87cbc5e60a2e54c",
|
|
100
|
+
"class": "ENGINE.PlayerStart",
|
|
101
|
+
"properties": {
|
|
102
|
+
"editorData": {
|
|
103
|
+
"displayName": "Player Start",
|
|
104
|
+
"hidden": false
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"ctor": {
|
|
108
|
+
"rootComponent": {
|
|
109
|
+
"class": "ENGINE.SceneComponent",
|
|
110
|
+
"uuid": "b4d5f8f7-2512-45e1-9157-c7ff6772402d",
|
|
111
|
+
"properties": {
|
|
112
|
+
"position": [
|
|
113
|
+
0,
|
|
114
|
+
0.9,
|
|
115
|
+
0,
|
|
116
|
+
"v"
|
|
117
|
+
]
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
{
|
|
123
|
+
"uuid": "0ba1f4677e8370d1",
|
|
124
|
+
"class": "ENGINE.Actor",
|
|
125
|
+
"properties": {
|
|
126
|
+
"editorData": {
|
|
127
|
+
"displayName": "Skybox",
|
|
128
|
+
"hidden": false
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
"ctor": {
|
|
132
|
+
"rootComponent": {
|
|
133
|
+
"class": "ENGINE.SceneComponent",
|
|
134
|
+
"uuid": "195e88df-73ff-4f4b-82ae-7fb58671463d",
|
|
135
|
+
"children": [
|
|
136
|
+
{
|
|
137
|
+
"class": "ENGINE.SkyboxComponent",
|
|
138
|
+
"uuid": "f7e33ae7d5ac74f9",
|
|
139
|
+
"ctor": {
|
|
140
|
+
"textureUrl": "@engine/assets/textures/skybox/citrus_orchard_road_puresky_2k.hdr",
|
|
141
|
+
"width": 2048,
|
|
142
|
+
"height": 1024,
|
|
143
|
+
"bottomColor": "#E6F3FF",
|
|
144
|
+
"middleColor": "#4A90E2",
|
|
145
|
+
"topColor": "#0F1B3C",
|
|
146
|
+
"envMapIntensity": 1,
|
|
147
|
+
"backgroundIntensity": 1,
|
|
148
|
+
"backgroundBlurriness": 0,
|
|
149
|
+
"envMapRotation": [
|
|
150
|
+
0,
|
|
151
|
+
0,
|
|
152
|
+
0,
|
|
153
|
+
"e"
|
|
154
|
+
]
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
]
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
"uuid": "01155a02b0cf79cc",
|
|
163
|
+
"class": "GAME.SampleVRActor",
|
|
164
|
+
"ctor": {
|
|
165
|
+
"actorTags": [],
|
|
166
|
+
"rootComponent": {
|
|
167
|
+
"class": "ENGINE.MeshComponent",
|
|
168
|
+
"uuid": "eab8ac7623a2c4c8",
|
|
169
|
+
"ctor": {
|
|
170
|
+
"physicsOptions": {
|
|
171
|
+
"motionType": "dynamic",
|
|
172
|
+
"collisionMeshType": "boundingBox"
|
|
173
|
+
},
|
|
174
|
+
"geometry": {
|
|
175
|
+
"class": "THREE.BoxGeometry",
|
|
176
|
+
"ctor": [
|
|
177
|
+
1,
|
|
178
|
+
1,
|
|
179
|
+
1
|
|
180
|
+
]
|
|
181
|
+
},
|
|
182
|
+
"material": {
|
|
183
|
+
"class": "THREE.MeshStandardMaterial",
|
|
184
|
+
"ctor": {
|
|
185
|
+
"defines": {
|
|
186
|
+
"STANDARD": ""
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
},
|
|
190
|
+
"excludeFromNavigation": false,
|
|
191
|
+
"uvScaleTilesPerUnit": 1
|
|
192
|
+
},
|
|
193
|
+
"children": [
|
|
194
|
+
{
|
|
195
|
+
"class": "ENGINE.VRGrabbableComponent",
|
|
196
|
+
"uuid": "d9fd1e6fd3409c76",
|
|
197
|
+
"ctor": {
|
|
198
|
+
"vrAttachmentInputType": "select",
|
|
199
|
+
"hideController": false,
|
|
200
|
+
"attachmentMode": "beam"
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
],
|
|
204
|
+
"properties": {
|
|
205
|
+
"position": [
|
|
206
|
+
0,
|
|
207
|
+
0,
|
|
208
|
+
-7.4,
|
|
209
|
+
"v"
|
|
210
|
+
]
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"properties": {
|
|
217
|
+
"editorData": {
|
|
218
|
+
"sceneTree": {
|
|
219
|
+
"id": "c0ae85792bc3b946",
|
|
220
|
+
"nodeType": "scene",
|
|
221
|
+
"children": [
|
|
222
|
+
{
|
|
223
|
+
"id": "9a86d389088b361c",
|
|
224
|
+
"nodeType": "actor"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
"id": "9d428f2a16e5374a",
|
|
228
|
+
"nodeType": "actor"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
"id": "b87cbc5e60a2e54c",
|
|
232
|
+
"nodeType": "actor"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
"id": "0ba1f4677e8370d1",
|
|
236
|
+
"nodeType": "actor"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"id": "01155a02b0cf79cc",
|
|
240
|
+
"nodeType": "actor"
|
|
241
|
+
}
|
|
242
|
+
]
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
"postProcessConfiguration": null
|
|
246
|
+
}
|
|
247
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './sample-vr-actor.ts';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
|
|
2
|
+
import * as ENGINE from 'genesys.js';
|
|
3
|
+
import * as THREE from 'three';
|
|
4
|
+
|
|
5
|
+
import './auto-imports.js';
|
|
6
|
+
|
|
7
|
+
class MyGame extends ENGINE.BaseGameLoop {
|
|
8
|
+
private pawn: ENGINE.VRPawn | null = null;
|
|
9
|
+
private controller: ENGINE.PlayerController | null = null;
|
|
10
|
+
|
|
11
|
+
protected override createLoadingScreen(): ENGINE.ILoadingScreen | null {
|
|
12
|
+
// enable the default loading screen
|
|
13
|
+
return new ENGINE.DefaultLoadingScreen();
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static override get DEFAULT_OPTIONS(): ENGINE.BaseGameLoopOptions {
|
|
17
|
+
return {
|
|
18
|
+
...ENGINE.BaseGameLoop.DEFAULT_OPTIONS,
|
|
19
|
+
xrEnabled: true,
|
|
20
|
+
vrSessionOptions: {
|
|
21
|
+
optionalFeatures: ['hand-tracking', 'local-floor'],
|
|
22
|
+
requiredFeatures: []
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected override async preStart(): Promise<void> {
|
|
28
|
+
// Disable tone mapping for VR because it breaks VR
|
|
29
|
+
this.world.postProcessManager.disablePasses(ENGINE.PostProcessPass.ToneMapping);
|
|
30
|
+
|
|
31
|
+
// create the vr pawn
|
|
32
|
+
this.pawn = new ENGINE.VRPawn({
|
|
33
|
+
position: new THREE.Vector3(0, 0, 0),
|
|
34
|
+
movementComponent: null,
|
|
35
|
+
camera: new THREE.PerspectiveCamera(ENGINE.CAMERA_FOV, 1, ENGINE.CAMERA_NEAR, ENGINE.CAMERA_FAR),
|
|
36
|
+
controllerOptions: {
|
|
37
|
+
rayVisualizationEnabled: true,
|
|
38
|
+
maxRayDistance: 10
|
|
39
|
+
},
|
|
40
|
+
enableTeleportation: true,
|
|
41
|
+
enableSnapTurn: true,
|
|
42
|
+
snapTurnAngle: 30,
|
|
43
|
+
maxTeleportDistance: 15
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// create the controller and possess the pawn
|
|
47
|
+
this.controller = new ENGINE.PlayerController();
|
|
48
|
+
this.controller.possess(this.pawn);
|
|
49
|
+
|
|
50
|
+
this.pawn.addComponent(new ENGINE.VRGrabComponent({}));
|
|
51
|
+
this.pawn.addComponent(new ENGINE.VRSnapTurnComponent({ angleDeg: this.pawn.getSnapTurnAngleDegrees() }));
|
|
52
|
+
this.pawn.addComponent(new ENGINE.VRInteractComponent({ button: ENGINE.XRButton.Trigger }));
|
|
53
|
+
this.pawn.addComponent(new ENGINE.VRTeleportComponent({ maxDistance: 15 }));
|
|
54
|
+
|
|
55
|
+
// add both to the world
|
|
56
|
+
this.world.addActors(this.pawn, this.controller);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export function main(container: HTMLElement, gameId: string): ENGINE.IGameLoop {
|
|
61
|
+
const game = new MyGame(container, {
|
|
62
|
+
...MyGame.DEFAULT_OPTIONS,
|
|
63
|
+
gameId
|
|
64
|
+
});
|
|
65
|
+
return game;
|
|
66
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as ENGINE from 'genesys.js';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Sample VR Actor - A simple actor that can be picked up and manipulated in VR
|
|
6
|
+
*/
|
|
7
|
+
@ENGINE.GameClass()
|
|
8
|
+
export class SampleVRActor extends ENGINE.Actor {
|
|
9
|
+
private meshComponent: ENGINE.MeshComponent | null = null;
|
|
10
|
+
private grabbable: ENGINE.VRGrabbableComponent | null = null;
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
public override doBeginPlay(): void {
|
|
14
|
+
super.doBeginPlay();
|
|
15
|
+
this.meshComponent = this.getComponent(ENGINE.MeshComponent);
|
|
16
|
+
this.grabbable = this.getComponent(ENGINE.VRGrabbableComponent);
|
|
17
|
+
|
|
18
|
+
this.grabbable?.onGrabStart.add((_hand) => {
|
|
19
|
+
this.meshComponent?.setPhysicsEnabled(false);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
this.grabbable?.onGrabEnd.add((_hand, _dropVelocity) => {
|
|
23
|
+
this.meshComponent?.setPhysicsEnabled(true);
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2021",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": [
|
|
7
|
+
"ES2021",
|
|
8
|
+
"DOM",
|
|
9
|
+
"DOM.Iterable"
|
|
10
|
+
],
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"moduleResolution": "node",
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"isolatedModules": true,
|
|
16
|
+
"jsx": "preserve",
|
|
17
|
+
"strict": true,
|
|
18
|
+
"noUnusedLocals": false,
|
|
19
|
+
"noUnusedParameters": false,
|
|
20
|
+
"noFallthroughCasesInSwitch": true,
|
|
21
|
+
"outDir": "./dist",
|
|
22
|
+
"rootDir": ".",
|
|
23
|
+
"declaration": true,
|
|
24
|
+
"inlineSourceMap": true,
|
|
25
|
+
"experimentalDecorators": true,
|
|
26
|
+
"noImplicitOverride": true,
|
|
27
|
+
"noEmit": true,
|
|
28
|
+
"types": ["node"]
|
|
29
|
+
},
|
|
30
|
+
"include": [
|
|
31
|
+
"src/**/*",
|
|
32
|
+
"scripts/**/*",
|
|
33
|
+
"vite.config.ts"
|
|
34
|
+
]
|
|
35
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { defineConfig } from 'vite';
|
|
2
|
+
import mkcert from 'vite-plugin-mkcert';
|
|
3
|
+
import { nodePolyfills } from 'vite-plugin-node-polyfills';
|
|
4
|
+
|
|
5
|
+
export default defineConfig({
|
|
6
|
+
// Enable TypeScript support
|
|
7
|
+
esbuild: {
|
|
8
|
+
target: 'es2021',
|
|
9
|
+
},
|
|
10
|
+
|
|
11
|
+
plugins: [
|
|
12
|
+
nodePolyfills({
|
|
13
|
+
include: ['path'],
|
|
14
|
+
}),
|
|
15
|
+
(mkcert as any)(),
|
|
16
|
+
],
|
|
17
|
+
|
|
18
|
+
// Configure module resolution
|
|
19
|
+
resolve: {
|
|
20
|
+
extensions: ['.ts', '.tsx', '.js', '.jsx', '.json'],
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
// Configure the dev server
|
|
24
|
+
server: {
|
|
25
|
+
port: 3000,
|
|
26
|
+
host: '0.0.0.0',
|
|
27
|
+
open: true,
|
|
28
|
+
// Enable CORS for asset loading
|
|
29
|
+
cors: true,
|
|
30
|
+
// Serve source maps for debugging
|
|
31
|
+
fs: {
|
|
32
|
+
allow: ['..', '.']
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// Configure build options
|
|
37
|
+
build: {
|
|
38
|
+
target: 'es2021',
|
|
39
|
+
outDir: 'dist',
|
|
40
|
+
sourcemap: true,
|
|
41
|
+
rollupOptions: {
|
|
42
|
+
input: {
|
|
43
|
+
main: 'index.html',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
// Enable source maps for debugging in development
|
|
49
|
+
css: {
|
|
50
|
+
devSourcemap: true,
|
|
51
|
+
},
|
|
52
|
+
});
|