create-playcanvas 0.5.0 → 0.6.0
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 +20 -27
- package/dist/index.mjs +44 -42
- package/package.json +1 -1
- package/templates/_features/physics/assets/public/ammo/LICENSE +21 -0
- package/templates/_features/physics/assets/public/ammo/SOURCE.md +16 -0
- package/templates/_features/physics/assets/public/ammo/ammo.js +973 -0
- package/templates/_features/physics/assets/public/ammo/ammo.wasm.js +937 -0
- package/templates/_features/physics/assets/public/ammo/ammo.wasm.wasm +0 -0
- package/templates/_features/physics/react/package.json +5 -0
- package/templates/_features/physics/react/src/sync-ammo.d.ts +4 -0
- package/templates/_shared/ar-placement/README.md +7 -0
- package/templates/_shared/ar-placement/src/ar-placement.ts +123 -0
- package/templates/_shared/first-person-controller/README.md +7 -0
- package/templates/_shared/first-person-controller/src/controller.ts +18 -0
- package/templates/_shared/first-person-controller/src/scripts.d.ts +5 -0
- package/templates/_shared/interactive-sphere/README.md +7 -0
- package/templates/_shared/model-viewer/README.md +7 -0
- package/templates/_shared/physics-playground/README.md +7 -0
- package/templates/_shared/product-configurator/ASSET_LICENSES.md +3 -0
- package/templates/_shared/product-configurator/README.md +7 -0
- package/templates/_shared/product-configurator/src/product.css +14 -0
- package/templates/_shared/scene-editor/README.md +7 -0
- package/templates/_shared/scene-editor/src/scene-editor.ts +57 -0
- package/templates/_shared/spinning-cube/README.md +7 -0
- package/templates/_shared/splat-viewer/README.md +7 -0
- package/templates/_shared/sprite-game/README.md +7 -0
- package/templates/_shared/sprite-game/src/sprite-game.ts +197 -0
- package/templates/_shared/third-person-controller/README.md +7 -0
- package/templates/_shared/third-person-controller/src/controller.ts +53 -0
- package/templates/_shared/third-person-controller/src/scripts.d.ts +5 -0
- package/templates/_shared/vr-starter/README.md +7 -0
- package/templates/_shared/vr-starter/src/vr.ts +40 -0
- package/templates/_shared/vr-starter/src/xr.d.ts +11 -0
- package/templates/engine/ar-placement/src/main.ts +77 -0
- package/templates/engine/base/.prettierignore +1 -0
- package/templates/engine/base/README.md +1 -1
- package/templates/engine/base/_npmrc +1 -0
- package/templates/engine/base/eslint.config.mjs +1 -1
- package/templates/engine/base/index.html +13 -0
- package/templates/engine/base/package.json +2 -2
- package/templates/engine/base/src/starter.css +104 -0
- package/templates/engine/first-person-controller/src/main.ts +139 -0
- package/templates/engine/interactive-sphere/src/App.ts +9 -7
- package/templates/engine/interactive-sphere/src/main.ts +2 -29
- package/templates/engine/interactive-sphere/src/style.css +18 -97
- package/templates/engine/model-viewer/src/main.ts +3 -2
- package/templates/engine/physics-playground/src/main.ts +132 -0
- package/templates/engine/product-configurator/src/main.ts +156 -0
- package/templates/engine/scene-editor/src/main.ts +90 -0
- package/templates/engine/splat-viewer/src/main.ts +4 -3
- package/templates/engine/sprite-game/src/main.ts +72 -0
- package/templates/engine/third-person-controller/src/main.ts +216 -0
- package/templates/engine/vr-starter/src/main.ts +101 -0
- package/templates/index.ts +66 -5
- package/templates/react/ar-placement/src/App.tsx +58 -0
- package/templates/react/base/.prettierignore +1 -0
- package/templates/react/base/README.md +1 -1
- package/templates/react/base/_npmrc +1 -0
- package/templates/react/base/eslint.config.mjs +1 -1
- package/templates/react/base/index.html +13 -0
- package/templates/react/base/package.json +2 -2
- package/templates/react/base/src/main.tsx +10 -0
- package/templates/react/base/src/starter.css +104 -0
- package/templates/react/first-person-controller/src/App.tsx +115 -0
- package/templates/react/interactive-sphere/src/App.css +18 -68
- package/templates/react/interactive-sphere/src/App.tsx +1 -22
- package/templates/react/interactive-sphere/src/Scene.tsx +7 -6
- package/templates/react/interactive-sphere/src/index.css +1 -48
- package/templates/react/model-viewer/src/App.tsx +2 -2
- package/templates/react/physics-playground/src/App.tsx +85 -0
- package/templates/react/product-configurator/src/App.tsx +157 -0
- package/templates/react/scene-editor/src/App.tsx +84 -0
- package/templates/react/splat-viewer/src/App.tsx +3 -3
- package/templates/react/sprite-game/src/App.tsx +38 -0
- package/templates/react/third-person-controller/src/App.tsx +193 -0
- package/templates/react/vr-starter/src/App.tsx +99 -0
- package/templates/web-components/ar-placement/index.html +44 -0
- package/templates/web-components/ar-placement/src/main.ts +13 -0
- package/templates/web-components/base/.prettierignore +1 -0
- package/templates/web-components/base/README.md +1 -1
- package/templates/web-components/base/_npmrc +1 -0
- package/templates/web-components/base/eslint.config.mjs +1 -1
- package/templates/web-components/base/package.json +3 -3
- package/templates/web-components/base/src/starter.css +104 -0
- package/templates/web-components/first-person-controller/index.html +168 -0
- package/templates/web-components/first-person-controller/src/main.ts +15 -0
- package/templates/web-components/interactive-sphere/index.html +5 -22
- package/templates/web-components/interactive-sphere/src/main.ts +5 -4
- package/templates/web-components/interactive-sphere/src/style.css +18 -76
- package/templates/web-components/model-viewer/index.html +1 -1
- package/templates/web-components/model-viewer/src/main.ts +2 -1
- package/templates/web-components/physics-playground/index.html +51 -0
- package/templates/web-components/physics-playground/src/main.ts +32 -0
- package/templates/web-components/product-configurator/index.html +51 -0
- package/templates/web-components/product-configurator/src/main.ts +93 -0
- package/templates/web-components/scene-editor/index.html +51 -0
- package/templates/web-components/scene-editor/src/main.ts +26 -0
- package/templates/web-components/spinning-cube/src/main.ts +1 -0
- package/templates/web-components/splat-viewer/index.html +2 -2
- package/templates/web-components/splat-viewer/src/main.ts +2 -1
- package/templates/web-components/sprite-game/index.html +34 -0
- package/templates/web-components/sprite-game/src/main.ts +9 -0
- package/templates/web-components/third-person-controller/index.html +183 -0
- package/templates/web-components/third-person-controller/src/main.ts +16 -0
- package/templates/web-components/vr-starter/index.html +80 -0
- package/templates/web-components/vr-starter/src/main.ts +12 -0
- package/templates/engine/interactive-sphere/src/assets/typescript.svg +0 -1
- package/templates/react/interactive-sphere/src/assets/react.svg +0 -1
- package/templates/web-components/interactive-sphere/src/assets/typescript.svg +0 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>Third-Person Controller</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<pc-app>
|
|
11
|
+
<pc-material id="ground-material" diffuse="#33662e"></pc-material>
|
|
12
|
+
<pc-material id="block-material" diffuse="#57594d"></pc-material>
|
|
13
|
+
<pc-material id="wood-material" diffuse="#572e14"></pc-material>
|
|
14
|
+
<pc-material id="leaves-material" diffuse="#144d1f"></pc-material>
|
|
15
|
+
<pc-material id="tips-material" diffuse="#1f6629"></pc-material>
|
|
16
|
+
<pc-material id="shirt-material" diffuse="#268bd2"></pc-material>
|
|
17
|
+
<pc-material id="skin-material" diffuse="#c78759"></pc-material>
|
|
18
|
+
<pc-material id="pants-material" diffuse="#2e4a85"></pc-material>
|
|
19
|
+
<pc-module
|
|
20
|
+
name="Ammo"
|
|
21
|
+
glue="/ammo/ammo.wasm.js"
|
|
22
|
+
wasm="/ammo/ammo.wasm.wasm"
|
|
23
|
+
fallback="/ammo/ammo.js"
|
|
24
|
+
></pc-module>
|
|
25
|
+
<pc-scene>
|
|
26
|
+
<pc-entity name="camera" position="0 3 6"><pc-camera clear-color="#7ab8e6"></pc-camera></pc-entity>
|
|
27
|
+
<pc-entity name="light" rotation="45 30 0"
|
|
28
|
+
><pc-light
|
|
29
|
+
type="directional"
|
|
30
|
+
intensity="2.5"
|
|
31
|
+
cast-shadows
|
|
32
|
+
shadow-bias="0.2"
|
|
33
|
+
normal-offset-bias="0.05"
|
|
34
|
+
></pc-light
|
|
35
|
+
></pc-entity>
|
|
36
|
+
<pc-entity name="ground" position="0 -0.1 0" scale="20 0.2 20"
|
|
37
|
+
><pc-render type="box" material="ground-material"></pc-render
|
|
38
|
+
><pc-collision type="box" half-extents="10 0.1 10"></pc-collision
|
|
39
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
40
|
+
></pc-entity>
|
|
41
|
+
<pc-entity name="block-0" position="-4.5 0.5 -3.5" scale="2.4 1 2.4"
|
|
42
|
+
><pc-render type="box" material="block-material"></pc-render
|
|
43
|
+
><pc-collision type="box" half-extents="1.2 0.5 1.2"></pc-collision
|
|
44
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
45
|
+
></pc-entity>
|
|
46
|
+
<pc-entity name="block-1" position="4.2 0.5 -2.8" rotation="0 25 0" scale="2.4 1 2.4"
|
|
47
|
+
><pc-render type="box" material="block-material"></pc-render
|
|
48
|
+
><pc-collision type="box" half-extents="1.2 0.5 1.2"></pc-collision
|
|
49
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
50
|
+
></pc-entity>
|
|
51
|
+
<pc-entity name="block-2" position="-3.7 0.5 3.2" rotation="0 50 0" scale="2.4 1 2.4"
|
|
52
|
+
><pc-render type="box" material="block-material"></pc-render
|
|
53
|
+
><pc-collision type="box" half-extents="1.2 0.5 1.2"></pc-collision
|
|
54
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
55
|
+
></pc-entity>
|
|
56
|
+
<pc-entity name="block-3" position="3.8 0.5 3.6" rotation="0 75 0" scale="2.4 1 2.4"
|
|
57
|
+
><pc-render type="box" material="block-material"></pc-render
|
|
58
|
+
><pc-collision type="box" half-extents="1.2 0.5 1.2"></pc-collision
|
|
59
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
60
|
+
></pc-entity>
|
|
61
|
+
<pc-entity name="tree-0-trunk" position="-7 0.99 -6" scale="0.418 1.98 0.418"
|
|
62
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
63
|
+
><pc-collision type="box" half-extents="0.209 0.99 0.209"></pc-collision
|
|
64
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
65
|
+
></pc-entity>
|
|
66
|
+
<pc-entity name="tree-0-crown-0" position="-7 2.09 -6" scale="2.31 1.98 2.31"
|
|
67
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
68
|
+
></pc-entity>
|
|
69
|
+
<pc-entity name="tree-0-crown-1" position="-7 2.915 -6" scale="1.76 1.705 1.76"
|
|
70
|
+
><pc-render type="cone" material="tips-material"></pc-render
|
|
71
|
+
></pc-entity>
|
|
72
|
+
<pc-entity name="tree-0-crown-2" position="-7 3.63 -6" scale="1.21 1.54 1.21"
|
|
73
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
74
|
+
></pc-entity>
|
|
75
|
+
<pc-entity name="tree-1-trunk" position="6.5 1.125 -6.5" scale="0.475 2.25 0.475"
|
|
76
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
77
|
+
><pc-collision type="box" half-extents="0.2375 1.125 0.2375"></pc-collision
|
|
78
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
79
|
+
></pc-entity>
|
|
80
|
+
<pc-entity name="tree-1-crown-0" position="6.5 2.375 -6.5" scale="2.625 2.25 2.625"
|
|
81
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
82
|
+
></pc-entity>
|
|
83
|
+
<pc-entity name="tree-1-crown-1" position="6.5 3.3125 -6.5" scale="2 1.9375 2"
|
|
84
|
+
><pc-render type="cone" material="tips-material"></pc-render
|
|
85
|
+
></pc-entity>
|
|
86
|
+
<pc-entity name="tree-1-crown-2" position="6.5 4.125 -6.5" scale="1.375 1.75 1.375"
|
|
87
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
88
|
+
></pc-entity>
|
|
89
|
+
<pc-entity name="tree-2-trunk" position="-7.5 0.81 5" scale="0.342 1.62 0.342"
|
|
90
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
91
|
+
><pc-collision type="box" half-extents="0.171 0.81 0.171"></pc-collision
|
|
92
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
93
|
+
></pc-entity>
|
|
94
|
+
<pc-entity name="tree-2-crown-0" position="-7.5 1.71 5" scale="1.89 1.62 1.89"
|
|
95
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
96
|
+
></pc-entity>
|
|
97
|
+
<pc-entity name="tree-2-crown-1" position="-7.5 2.385 5" scale="1.44 1.395 1.44"
|
|
98
|
+
><pc-render type="cone" material="tips-material"></pc-render
|
|
99
|
+
></pc-entity>
|
|
100
|
+
<pc-entity name="tree-2-crown-2" position="-7.5 2.97 5" scale="0.99 1.26 0.99"
|
|
101
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
102
|
+
></pc-entity>
|
|
103
|
+
<pc-entity name="tree-3-trunk" position="7 1.035 5.5" scale="0.437 2.07 0.437"
|
|
104
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
105
|
+
><pc-collision type="box" half-extents="0.2185 1.035 0.2185"></pc-collision
|
|
106
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
107
|
+
></pc-entity>
|
|
108
|
+
<pc-entity name="tree-3-crown-0" position="7 2.185 5.5" scale="2.415 2.07 2.415"
|
|
109
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
110
|
+
></pc-entity>
|
|
111
|
+
<pc-entity name="tree-3-crown-1" position="7 3.0475 5.5" scale="1.84 1.7825 1.84"
|
|
112
|
+
><pc-render type="cone" material="tips-material"></pc-render
|
|
113
|
+
></pc-entity>
|
|
114
|
+
<pc-entity name="tree-3-crown-2" position="7 3.795 5.5" scale="1.265 1.61 1.265"
|
|
115
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
116
|
+
></pc-entity>
|
|
117
|
+
<pc-entity name="tree-4-trunk" position="-2.2 0.765 -8" scale="0.323 1.53 0.323"
|
|
118
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
119
|
+
><pc-collision type="box" half-extents="0.1615 0.765 0.1615"></pc-collision
|
|
120
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
121
|
+
></pc-entity>
|
|
122
|
+
<pc-entity name="tree-4-crown-0" position="-2.2 1.615 -8" scale="1.785 1.53 1.785"
|
|
123
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
124
|
+
></pc-entity>
|
|
125
|
+
<pc-entity name="tree-4-crown-1" position="-2.2 2.2525 -8" scale="1.36 1.3175 1.36"
|
|
126
|
+
><pc-render type="cone" material="tips-material"></pc-render
|
|
127
|
+
></pc-entity>
|
|
128
|
+
<pc-entity name="tree-4-crown-2" position="-2.2 2.805 -8" scale="0.935 1.19 0.935"
|
|
129
|
+
><pc-render type="cone" material="leaves-material"></pc-render
|
|
130
|
+
></pc-entity>
|
|
131
|
+
<pc-entity name="fallen-log" position="0 0.35 6" scale="3.8 0.7 0.7"
|
|
132
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
133
|
+
><pc-collision type="box" half-extents="1.9 0.35 0.35"></pc-collision
|
|
134
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
135
|
+
></pc-entity>
|
|
136
|
+
<pc-entity name="stump" position="-1.8 0.4 -2.2" scale="0.9 0.8 0.9"
|
|
137
|
+
><pc-render type="box" material="wood-material"></pc-render
|
|
138
|
+
><pc-collision type="box" half-extents="0.45 0.4 0.45"></pc-collision
|
|
139
|
+
><pc-rigidbody type="static"></pc-rigidbody
|
|
140
|
+
></pc-entity>
|
|
141
|
+
<pc-entity name="player" position="0 1.1 0">
|
|
142
|
+
<pc-collision type="capsule" radius="0.5" height="2.4" linear-offset="0 0.1 0"></pc-collision>
|
|
143
|
+
<pc-rigidbody type="dynamic" mass="70" angular-factor="0 0 0"></pc-rigidbody>
|
|
144
|
+
<pc-entity name="character" position="0 0.2 0">
|
|
145
|
+
<pc-entity name="body" scale="0.56 0.88 0.38"
|
|
146
|
+
><pc-render type="box" material="shirt-material"></pc-render
|
|
147
|
+
></pc-entity>
|
|
148
|
+
<pc-entity name="head" position="0 0.76 0" scale="0.52 0.6 0.52"
|
|
149
|
+
><pc-render type="box" material="skin-material"></pc-render
|
|
150
|
+
></pc-entity>
|
|
151
|
+
<pc-entity name="left-arm" position="-0.38 0.44 0">
|
|
152
|
+
<pc-entity position="0 -0.44 0" scale="0.18 0.88 0.32"
|
|
153
|
+
><pc-render type="box" material="shirt-material"></pc-render
|
|
154
|
+
></pc-entity>
|
|
155
|
+
</pc-entity>
|
|
156
|
+
<pc-entity name="right-arm" position="0.38 0.44 0">
|
|
157
|
+
<pc-entity position="0 -0.44 0" scale="0.18 0.88 0.32"
|
|
158
|
+
><pc-render type="box" material="shirt-material"></pc-render
|
|
159
|
+
></pc-entity>
|
|
160
|
+
</pc-entity>
|
|
161
|
+
<pc-entity name="left-leg" position="-0.15 -0.44 0">
|
|
162
|
+
<pc-entity position="0 -0.43 0" scale="0.24 0.86 0.34"
|
|
163
|
+
><pc-render type="box" material="pants-material"></pc-render
|
|
164
|
+
></pc-entity>
|
|
165
|
+
</pc-entity>
|
|
166
|
+
<pc-entity name="right-leg" position="0.15 -0.44 0">
|
|
167
|
+
<pc-entity position="0 -0.43 0" scale="0.24 0.86 0.34"
|
|
168
|
+
><pc-render type="box" material="pants-material"></pc-render
|
|
169
|
+
></pc-entity>
|
|
170
|
+
</pc-entity>
|
|
171
|
+
</pc-entity>
|
|
172
|
+
</pc-entity>
|
|
173
|
+
</pc-scene>
|
|
174
|
+
</pc-app>
|
|
175
|
+
<div class="hud">
|
|
176
|
+
<section class="panel">
|
|
177
|
+
<h1>Third-Person Controller</h1>
|
|
178
|
+
<p>Click the scene, then use WASD to move, mouse to orbit and Space to jump.</p>
|
|
179
|
+
</section>
|
|
180
|
+
</div>
|
|
181
|
+
<script type="module" src="/src/main.ts"></script>
|
|
182
|
+
</body>
|
|
183
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EntityElement } from '@playcanvas/web-components';
|
|
2
|
+
import { whenReady } from '@playcanvas/web-components';
|
|
3
|
+
|
|
4
|
+
import { addThirdPersonController } from './controller';
|
|
5
|
+
import './starter.css';
|
|
6
|
+
|
|
7
|
+
await Promise.all([
|
|
8
|
+
whenReady('pc-entity[name="player"] > pc-collision'),
|
|
9
|
+
whenReady('pc-entity[name="player"] > pc-rigidbody')
|
|
10
|
+
]);
|
|
11
|
+
const [player, camera, model] = await Promise.all([
|
|
12
|
+
whenReady<EntityElement>('pc-entity[name="player"]'),
|
|
13
|
+
whenReady<EntityElement>('pc-entity[name="camera"]'),
|
|
14
|
+
whenReady<EntityElement>('pc-entity[name="character"]')
|
|
15
|
+
]);
|
|
16
|
+
addThirdPersonController(player.entity!, camera.entity!, model.entity!);
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" type="image/png" href="/src/assets/playcanvas.png" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
|
+
<title>VR Starter</title>
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<pc-app>
|
|
11
|
+
<pc-material id="floor-material" diffuse="#61666e"></pc-material>
|
|
12
|
+
<pc-material id="wall-material" diffuse="#3d424a"></pc-material>
|
|
13
|
+
<pc-material id="cyan" diffuse="#1fb3db"></pc-material>
|
|
14
|
+
<pc-material id="coral" diffuse="#ff594d"></pc-material>
|
|
15
|
+
<pc-material id="yellow" diffuse="#ffbf33"></pc-material>
|
|
16
|
+
<pc-scene>
|
|
17
|
+
<pc-entity name="light" rotation="45 30 0"
|
|
18
|
+
><pc-light
|
|
19
|
+
type="directional"
|
|
20
|
+
intensity="2"
|
|
21
|
+
cast-shadows
|
|
22
|
+
shadow-bias="0.2"
|
|
23
|
+
normal-offset-bias="0.05"
|
|
24
|
+
></pc-light
|
|
25
|
+
></pc-entity>
|
|
26
|
+
<pc-entity name="floor" scale="10 1 10"
|
|
27
|
+
><pc-render type="plane" material="floor-material"></pc-render
|
|
28
|
+
></pc-entity>
|
|
29
|
+
<pc-entity position="0 2 -3.5" scale="8 4 0.2"
|
|
30
|
+
><pc-render type="box" material="wall-material"></pc-render
|
|
31
|
+
></pc-entity>
|
|
32
|
+
<pc-entity position="-4 2 0" scale="0.2 4 7"
|
|
33
|
+
><pc-render type="box" material="wall-material"></pc-render
|
|
34
|
+
></pc-entity>
|
|
35
|
+
<pc-entity position="4 2 0" scale="0.2 4 7"
|
|
36
|
+
><pc-render type="box" material="wall-material"></pc-render
|
|
37
|
+
></pc-entity>
|
|
38
|
+
<pc-entity position="-2.4 2.4 -3.35" scale="1.3 1.3 0.12"
|
|
39
|
+
><pc-render type="box" material="cyan"></pc-render
|
|
40
|
+
></pc-entity>
|
|
41
|
+
<pc-entity position="0 2.4 -3.35" scale="1.3 1.3 0.12"
|
|
42
|
+
><pc-render type="box" material="coral"></pc-render
|
|
43
|
+
></pc-entity>
|
|
44
|
+
<pc-entity position="2.4 2.4 -3.35" scale="1.3 1.3 0.12"
|
|
45
|
+
><pc-render type="box" material="yellow"></pc-render
|
|
46
|
+
></pc-entity>
|
|
47
|
+
<pc-entity position="-2.4 0.45 -1.6" scale="1 0.9 1"
|
|
48
|
+
><pc-render type="box" material="wall-material"></pc-render
|
|
49
|
+
></pc-entity>
|
|
50
|
+
<pc-entity position="0 0.45 -1.6" scale="1 0.9 1"
|
|
51
|
+
><pc-render type="box" material="wall-material"></pc-render
|
|
52
|
+
></pc-entity>
|
|
53
|
+
<pc-entity position="2.4 0.45 -1.6" scale="1 0.9 1"
|
|
54
|
+
><pc-render type="box" material="wall-material"></pc-render
|
|
55
|
+
></pc-entity>
|
|
56
|
+
<pc-entity position="-2.4 1.35 -1.6" scale="0.7 0.7 0.7"
|
|
57
|
+
><pc-render type="sphere" material="cyan"></pc-render
|
|
58
|
+
></pc-entity>
|
|
59
|
+
<pc-entity position="0 1.35 -1.6" scale="0.7 0.7 0.7"
|
|
60
|
+
><pc-render type="box" material="coral"></pc-render
|
|
61
|
+
></pc-entity>
|
|
62
|
+
<pc-entity position="2.4 1.35 -1.6" scale="0.8 0.9 0.8"
|
|
63
|
+
><pc-render type="cone" material="yellow"></pc-render
|
|
64
|
+
></pc-entity>
|
|
65
|
+
<pc-entity name="xr-rig"
|
|
66
|
+
><pc-entity name="camera" position="0 1.6 4"
|
|
67
|
+
><pc-camera clear-color="#292e38"></pc-camera></pc-entity
|
|
68
|
+
></pc-entity>
|
|
69
|
+
</pc-scene>
|
|
70
|
+
</pc-app>
|
|
71
|
+
<div class="hud">
|
|
72
|
+
<section class="panel">
|
|
73
|
+
<h1>VR Starter</h1>
|
|
74
|
+
<p id="xr-status">Checking VR support…</p>
|
|
75
|
+
<div class="controls"><button id="xr-button" disabled>Enter VR</button></div>
|
|
76
|
+
</section>
|
|
77
|
+
</div>
|
|
78
|
+
<script type="module" src="/src/main.ts"></script>
|
|
79
|
+
</body>
|
|
80
|
+
</html>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { EntityElement } from '@playcanvas/web-components';
|
|
2
|
+
import { whenReady } from '@playcanvas/web-components';
|
|
3
|
+
|
|
4
|
+
import './starter.css';
|
|
5
|
+
import { setupVr } from './vr';
|
|
6
|
+
|
|
7
|
+
const [appElement, rig, camera] = await Promise.all([
|
|
8
|
+
whenReady('pc-app'),
|
|
9
|
+
whenReady<EntityElement>('pc-entity[name="xr-rig"]'),
|
|
10
|
+
whenReady<EntityElement>('pc-entity[name="camera"]')
|
|
11
|
+
]);
|
|
12
|
+
setupVr(appElement.app!, rig.entity!, camera.entity!);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#007ACC" d="M0 128v128h256V0H0z"></path><path fill="#FFF" d="m56.612 128.85l-.081 10.483h33.32v94.68h23.568v-94.68h33.321v-10.28c0-5.69-.122-10.444-.284-10.566c-.122-.162-20.4-.244-44.983-.203l-44.74.122l-.121 10.443Zm149.955-10.742c6.501 1.625 11.459 4.51 16.01 9.224c2.357 2.52 5.851 7.111 6.136 8.208c.08.325-11.053 7.802-17.798 11.988c-.244.162-1.22-.894-2.317-2.52c-3.291-4.795-6.745-6.867-12.028-7.233c-7.76-.528-12.759 3.535-12.718 10.321c0 1.992.284 3.17 1.097 4.795c1.707 3.536 4.876 5.649 14.832 9.956c18.326 7.883 26.168 13.084 31.045 20.48c5.445 8.249 6.664 21.415 2.966 31.208c-4.063 10.646-14.14 17.879-28.323 20.276c-4.388.772-14.79.65-19.504-.203c-10.28-1.828-20.033-6.908-26.047-13.572c-2.357-2.6-6.949-9.387-6.664-9.874c.122-.163 1.178-.813 2.356-1.504c1.138-.65 5.446-3.129 9.509-5.485l7.355-4.267l1.544 2.276c2.154 3.29 6.867 7.801 9.712 9.305c8.167 4.307 19.383 3.698 24.909-1.26c2.357-2.153 3.332-4.388 3.332-7.68c0-2.966-.366-4.266-1.91-6.501c-1.99-2.845-6.054-5.242-17.595-10.24c-13.206-5.69-18.895-9.224-24.096-14.832c-3.007-3.25-5.852-8.452-7.03-12.8c-.975-3.617-1.22-12.678-.447-16.335c2.723-12.76 12.353-21.659 26.25-24.3c4.51-.853 14.994-.528 19.424.569Z"></path></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="35.93" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 228"><path fill="#00D8FF" d="M210.483 73.824a171.49 171.49 0 0 0-8.24-2.597c.465-1.9.893-3.777 1.273-5.621c6.238-30.281 2.16-54.676-11.769-62.708c-13.355-7.7-35.196.329-57.254 19.526a171.23 171.23 0 0 0-6.375 5.848a155.866 155.866 0 0 0-4.241-3.917C100.759 3.829 77.587-4.822 63.673 3.233C50.33 10.957 46.379 33.89 51.995 62.588a170.974 170.974 0 0 0 1.892 8.48c-3.28.932-6.445 1.924-9.474 2.98C17.309 83.498 0 98.307 0 113.668c0 15.865 18.582 31.778 46.812 41.427a145.52 145.52 0 0 0 6.921 2.165a167.467 167.467 0 0 0-2.01 9.138c-5.354 28.2-1.173 50.591 12.134 58.266c13.744 7.926 36.812-.22 59.273-19.855a145.567 145.567 0 0 0 5.342-4.923a168.064 168.064 0 0 0 6.92 6.314c21.758 18.722 43.246 26.282 56.54 18.586c13.731-7.949 18.194-32.003 12.4-61.268a145.016 145.016 0 0 0-1.535-6.842c1.62-.48 3.21-.974 4.76-1.488c29.348-9.723 48.443-25.443 48.443-41.52c0-15.417-17.868-30.326-45.517-39.844Zm-6.365 70.984c-1.4.463-2.836.91-4.3 1.345c-3.24-10.257-7.612-21.163-12.963-32.432c5.106-11 9.31-21.767 12.459-31.957c2.619.758 5.16 1.557 7.61 2.4c23.69 8.156 38.14 20.213 38.14 29.504c0 9.896-15.606 22.743-40.946 31.14Zm-10.514 20.834c2.562 12.94 2.927 24.64 1.23 33.787c-1.524 8.219-4.59 13.698-8.382 15.893c-8.067 4.67-25.32-1.4-43.927-17.412a156.726 156.726 0 0 1-6.437-5.87c7.214-7.889 14.423-17.06 21.459-27.246c12.376-1.098 24.068-2.894 34.671-5.345a134.17 134.17 0 0 1 1.386 6.193ZM87.276 214.515c-7.882 2.783-14.16 2.863-17.955.675c-8.075-4.657-11.432-22.636-6.853-46.752a156.923 156.923 0 0 1 1.869-8.499c10.486 2.32 22.093 3.988 34.498 4.994c7.084 9.967 14.501 19.128 21.976 27.15a134.668 134.668 0 0 1-4.877 4.492c-9.933 8.682-19.886 14.842-28.658 17.94ZM50.35 144.747c-12.483-4.267-22.792-9.812-29.858-15.863c-6.35-5.437-9.555-10.836-9.555-15.216c0-9.322 13.897-21.212 37.076-29.293c2.813-.98 5.757-1.905 8.812-2.773c3.204 10.42 7.406 21.315 12.477 32.332c-5.137 11.18-9.399 22.249-12.634 32.792a134.718 134.718 0 0 1-6.318-1.979Zm12.378-84.26c-4.811-24.587-1.616-43.134 6.425-47.789c8.564-4.958 27.502 2.111 47.463 19.835a144.318 144.318 0 0 1 3.841 3.545c-7.438 7.987-14.787 17.08-21.808 26.988c-12.04 1.116-23.565 2.908-34.161 5.309a160.342 160.342 0 0 1-1.76-7.887Zm110.427 27.268a347.8 347.8 0 0 0-7.785-12.803c8.168 1.033 15.994 2.404 23.343 4.08c-2.206 7.072-4.956 14.465-8.193 22.045a381.151 381.151 0 0 0-7.365-13.322Zm-45.032-43.861c5.044 5.465 10.096 11.566 15.065 18.186a322.04 322.04 0 0 0-30.257-.006c4.974-6.559 10.069-12.652 15.192-18.18ZM82.802 87.83a323.167 323.167 0 0 0-7.227 13.238c-3.184-7.553-5.909-14.98-8.134-22.152c7.304-1.634 15.093-2.97 23.209-3.984a321.524 321.524 0 0 0-7.848 12.897Zm8.081 65.352c-8.385-.936-16.291-2.203-23.593-3.793c2.26-7.3 5.045-14.885 8.298-22.6a321.187 321.187 0 0 0 7.257 13.246c2.594 4.48 5.28 8.868 8.038 13.147Zm37.542 31.03c-5.184-5.592-10.354-11.779-15.403-18.433c4.902.192 9.899.29 14.978.29c5.218 0 10.376-.117 15.453-.343c-4.985 6.774-10.018 12.97-15.028 18.486Zm52.198-57.817c3.422 7.8 6.306 15.345 8.596 22.52c-7.422 1.694-15.436 3.058-23.88 4.071a382.417 382.417 0 0 0 7.859-13.026a347.403 347.403 0 0 0 7.425-13.565Zm-16.898 8.101a358.557 358.557 0 0 1-12.281 19.815a329.4 329.4 0 0 1-23.444.823c-7.967 0-15.716-.248-23.178-.732a310.202 310.202 0 0 1-12.513-19.846h.001a307.41 307.41 0 0 1-10.923-20.627a310.278 310.278 0 0 1 10.89-20.637l-.001.001a307.318 307.318 0 0 1 12.413-19.761c7.613-.576 15.42-.876 23.31-.876H128c7.926 0 15.743.303 23.354.883a329.357 329.357 0 0 1 12.335 19.695a358.489 358.489 0 0 1 11.036 20.54a329.472 329.472 0 0 1-11 20.722Zm22.56-122.124c8.572 4.944 11.906 24.881 6.52 51.026c-.344 1.668-.73 3.367-1.15 5.09c-10.622-2.452-22.155-4.275-34.23-5.408c-7.034-10.017-14.323-19.124-21.64-27.008a160.789 160.789 0 0 1 5.888-5.4c18.9-16.447 36.564-22.941 44.612-18.3ZM128 90.808c12.625 0 22.86 10.235 22.86 22.86s-10.235 22.86-22.86 22.86s-22.86-10.235-22.86-22.86s10.235-22.86 22.86-22.86Z"></path></svg>
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="32" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 256"><path fill="#007ACC" d="M0 128v128h256V0H0z"></path><path fill="#FFF" d="m56.612 128.85l-.081 10.483h33.32v94.68h23.568v-94.68h33.321v-10.28c0-5.69-.122-10.444-.284-10.566c-.122-.162-20.4-.244-44.983-.203l-44.74.122l-.121 10.443Zm149.955-10.742c6.501 1.625 11.459 4.51 16.01 9.224c2.357 2.52 5.851 7.111 6.136 8.208c.08.325-11.053 7.802-17.798 11.988c-.244.162-1.22-.894-2.317-2.52c-3.291-4.795-6.745-6.867-12.028-7.233c-7.76-.528-12.759 3.535-12.718 10.321c0 1.992.284 3.17 1.097 4.795c1.707 3.536 4.876 5.649 14.832 9.956c18.326 7.883 26.168 13.084 31.045 20.48c5.445 8.249 6.664 21.415 2.966 31.208c-4.063 10.646-14.14 17.879-28.323 20.276c-4.388.772-14.79.65-19.504-.203c-10.28-1.828-20.033-6.908-26.047-13.572c-2.357-2.6-6.949-9.387-6.664-9.874c.122-.163 1.178-.813 2.356-1.504c1.138-.65 5.446-3.129 9.509-5.485l7.355-4.267l1.544 2.276c2.154 3.29 6.867 7.801 9.712 9.305c8.167 4.307 19.383 3.698 24.909-1.26c2.357-2.153 3.332-4.388 3.332-7.68c0-2.966-.366-4.266-1.91-6.501c-1.99-2.845-6.054-5.242-17.595-10.24c-13.206-5.69-18.895-9.224-24.096-14.832c-3.007-3.25-5.852-8.452-7.03-12.8c-.975-3.617-1.22-12.678-.447-16.335c2.723-12.76 12.353-21.659 26.25-24.3c4.51-.853 14.994-.528 19.424.569Z"></path></svg>
|