|
@@ -28,12 +28,6 @@ class DemoUtils
|
28
|
28
|
return gltf;
|
29
|
29
|
}
|
30
|
30
|
|
31
|
|
- switchToFrontView(root)
|
32
|
|
- {
|
33
|
|
- // top view is the default
|
34
|
|
- root.rotateX(-Math.PI / 2);
|
35
|
|
- }
|
36
|
|
-
|
37
|
31
|
createAnimationAction(gltf, name = null)
|
38
|
32
|
{
|
39
|
33
|
const mixer = new THREE.AnimationMixer(gltf.scene);
|
|
@@ -61,6 +55,12 @@ class DemoUtils
|
61
|
55
|
return mesh;
|
62
|
56
|
}
|
63
|
57
|
|
|
58
|
+ switchToFrontView(ar)
|
|
59
|
+ {
|
|
60
|
+ // top view is the default
|
|
61
|
+ ar.root.rotation.set(-Math.PI / 2, 0, 0);
|
|
62
|
+ }
|
|
63
|
+
|
64
|
64
|
referenceImage(ar)
|
65
|
65
|
{
|
66
|
66
|
if(ar.frame === null)
|
|
@@ -165,7 +165,7 @@ class DemoScene extends ARScene
|
165
|
165
|
// Change the point of view. All virtual objects are descendants of
|
166
|
166
|
// ar.root, a node that is automatically aligned to the physical scene.
|
167
|
167
|
// Adjusting ar.root will adjust all virtual objects.
|
168
|
|
- this._utils.switchToFrontView(ar.root);
|
|
168
|
+ this._utils.switchToFrontView(ar);
|
169
|
169
|
ar.root.position.set(0, -0.5, 0);
|
170
|
170
|
ar.root.scale.set(0.7, 0.7, 0.7);
|
171
|
171
|
|
|
@@ -179,9 +179,9 @@ class DemoScene extends ARScene
|
179
|
179
|
|
180
|
180
|
// create the magic circle
|
181
|
181
|
const magicCircle = this._utils.createImagePlane('../assets/magic-circle.png');
|
|
182
|
+ magicCircle.material.color = new THREE.Color(0xbeefff);
|
182
|
183
|
magicCircle.material.transparent = true;
|
183
|
184
|
magicCircle.material.opacity = 0.85;
|
184
|
|
- magicCircle.material.color = new THREE.Color(0xbeefff);
|
185
|
185
|
magicCircle.scale.set(6, 6, 1);
|
186
|
186
|
ar.root.add(magicCircle);
|
187
|
187
|
|
|
@@ -191,7 +191,7 @@ class DemoScene extends ARScene
|
191
|
191
|
ar.root.add(mage);
|
192
|
192
|
|
193
|
193
|
// prepare the animation of the mage
|
194
|
|
- const animationAction = this._utils.createAnimationAction(gltf, 'Idle');
|
|
194
|
+ const animationAction = this._utils.createAnimationAction(gltf);
|
195
|
195
|
animationAction.loop = THREE.LoopRepeat;
|
196
|
196
|
animationAction.play();
|
197
|
197
|
|
|
@@ -221,16 +221,6 @@ class DemoScene extends ARScene
|
221
|
221
|
const magicCircle = this._objects.magicCircle;
|
222
|
222
|
magicCircle.rotateZ(TWO_PI * ROTATIONS_PER_SECOND * delta);
|
223
|
223
|
}
|
224
|
|
-
|
225
|
|
- /**
|
226
|
|
- * Release the augmented scene
|
227
|
|
- * @param {ARPluginSystem} ar
|
228
|
|
- * @returns {void}
|
229
|
|
- */
|
230
|
|
- release(ar)
|
231
|
|
- {
|
232
|
|
- // nothing to do
|
233
|
|
- }
|
234
|
224
|
}
|
235
|
225
|
|
236
|
226
|
|