Skip to content

Commit aa9860c

Browse files
committed
Update objects factory example
1 parent 4cfaed1 commit aa9860c

File tree

3 files changed

+71
-87
lines changed

3 files changed

+71
-87
lines changed

src/examples.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ <h3>Standalone Mode</h3>
8181
<li><a href="./examples/resize-window.html">Resize Window</a></li>
8282
<li><a href="./examples/texture-on-a-plane.html">Texture on a Plane</a></li>
8383
<li><a href="./examples/standalone/texture-cube.html">Texture Cube</a></li>
84+
<li><a href="./examples/standalone/work-with-objects-factory.html">Work with Objects Factory</a></li>
8485
<li><a href="./examples/objects-recycling.html">Objects Recycling</a></li>
8586
<li><a href="./examples/use-tweenjs.html">Use tween.js</a></li>
8687
<li><a href="./examples/project-options-and-multiple-scenes.html">Project Options and Multiple Scenes</a></li>
@@ -178,7 +179,6 @@ <h3>As 3D Extension for Phaser</h3>
178179
<li><a href="./examples/virtual-reality-phaser.html">Virtual Reality (with Phaser)</a></li>
179180
<li><a href="./examples/convex-objects-breaking-phaser.html">Convex Objects Breaking</a></li>
180181
<li><a href="./examples/use-native-three-code.html">Use "native" three.js code</a></li>
181-
<li><a href="./examples/work-with-objects-factory.html">Work with Objects Factory</a></li>
182182
<li><a href="./examples/heightmap-with-color-scale.html">Heightmap with Color Scale</a></li>
183183
<li><a href="./examples/water.html">Water</a></li>
184184
<li><a href="./examples/medieval-fantasy-book.html">Medieval Fantasy Book</a></li>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta
6+
name="viewport"
7+
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover"
8+
/>
9+
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
10+
<title>Work with Objects Factory</title>
11+
<link rel="stylesheet" href="/css/examples.css?ver=1.0.0" />
12+
<script src="/js/examples.js?ver=1.1.1"></script>
13+
<script src="/lib/nano.slim.0.0.15.min.js"></script>
14+
</head>
15+
16+
<body>
17+
<script type="importmap">
18+
{
19+
"imports": {
20+
"enable3d": "/lib/enable3d/enable3d.framework.0.26.0_dev0.module.min.js"
21+
}
22+
}
23+
</script>
24+
<script type="module">
25+
import { Project, Scene3D, PhysicsLoader, THREE, VERSION, FLAT } from 'enable3d'
26+
const { jsx, render } = nanoJSX
27+
28+
class MainScene extends Scene3D {
29+
create() {
30+
// remove orbitControls from warp speed features
31+
this.warpSpeed('-orbitControls')
32+
33+
// adjust the camera
34+
this.camera.position.set(10, 10, 25)
35+
this.camera.lookAt(0, 5, 0)
36+
37+
// enable physics debugging
38+
this.physics.debug.enable()
39+
this.physics.debug.mode(1)
40+
41+
/**
42+
* Boxes
43+
*/
44+
const cube0 = this.make.box({ x: 2.5, y: 5 }) // make
45+
this.add.existing(cube0) // add to scene
46+
this.physics.add.existing(cube0) // add physics
47+
48+
const cube1 = this.add.box({ x: 2.5, y: 10 }) // make and add to scene
49+
this.physics.add.existing(cube1) // add physics
50+
51+
const cube2 = this.physics.add.box({ x: 2.5, y: 15 }) // make, add to scene and add physics
52+
53+
/**
54+
* Spheres
55+
*/
56+
const sphere0 = this.make.sphere({ x: -2.5, y: 5 })
57+
this.add.existing(sphere0)
58+
this.physics.add.existing(sphere0)
59+
60+
const sphere1 = this.add.sphere({ x: -2.5, y: 10 })
61+
this.physics.add.existing(sphere1)
62+
63+
const sphere2 = this.physics.add.sphere({ x: -2.5, y: 15 })
64+
}
65+
}
66+
67+
PhysicsLoader('/lib/ammo/kripken', () => new Project({ scenes: [MainScene], antialias: true }))
68+
</script>
69+
</body>
70+
</html>

src/examples/work-with-objects-factory.html

Lines changed: 0 additions & 86 deletions
This file was deleted.

0 commit comments

Comments
 (0)