Skip to content

Commit 23b965a

Browse files
authored
Update creating-3d-scenes-games-threejs.md
1 parent 676b157 commit 23b965a

File tree

1 file changed

+21
-19
lines changed

1 file changed

+21
-19
lines changed

en/drafts/originals/creating-3d-scenes-games-threejs.md

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ Add:
353353
let desk = 0.8; // desk height
354354
let gheight = desk + 0.55; //panel height
355355
let psize = 1.0; // panel dimensions
356+
let sphereposx = 0.84 // key sphere x position
357+
let sphereposz = -0.75 // key sphere x position
356358
357359
```
358360

@@ -380,31 +382,31 @@ Add:
380382
const sphere = new THREE.SphereGeometry( 0.04, 15, 5); //radius, width segments, height segments
381383
382384
const sphere1 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.materialColor }));
383-
sphere1.position.set( 0.84, gheight + (psize *.30), -.75);
385+
sphere1.position.set( sphereposx, gheight + .30, sphereposz);
384386
385387
const sphere2 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.coilColor }));
386-
sphere2.position.set( 0.84, gheight + (psize *.21), -.75);
388+
sphere2.position.set( sphereposx, gheight + .21, sphereposz);
387389
388390
const sphere3 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.wangelaColor }));
389-
sphere3.position.set( 0.84, gheight - (psize *.15), -.75);
391+
sphere3.position.set( sphereposx, gheight - .15, sphereposz);
390392
391393
const sphere4 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.nabColor }));
392-
sphere4.position.set( 0.84, gheight - (psize *.06), -.75);
394+
sphere4.position.set( sphereposx, gheight - .06, sphereposz);
393395
394396
const sphere5 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.paddleAddColor}));
395-
sphere5.position.set( 0.84, gheight - (psize *.35), -.75);
397+
sphere5.position.set( sphereposx, gheight - *.35, sphereposz);
396398
397399
const sphere6 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.coilBeatenColor}));
398-
sphere6.position.set( 0.84, gheight + (psize *.03), -.75);
400+
sphere6.position.set( sphereposx, gheight + .03, sphereposz);
399401
400402
const sphere7 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.amphColor }));
401-
sphere7.position.set( 0.84, gheight - (psize *.44), -.75);
403+
sphere7.position.set( sphereposx, gheight - .44, sphereposz);
402404
403405
const sphere8 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.paddleColor}));
404-
sphere8.position.set( 0.84, gheight - (psize *.25), -.75);
406+
sphere8.position.set( sphereposx, gheight - .25, sphereposz);
405407
406408
const sphere9 = new THREE.Mesh( sphere, new THREE.MeshStandardMaterial( {color: parameters.ringTopColor}));
407-
sphere9.position.set( 0.84, gheight + (psize *.12), -.75);
409+
sphere9.position.set( sphereposx, gheight + .12, sphereposz);
408410
409411
scene.add( sphere1, sphere2, sphere3, sphere4, sphere5, sphere6, sphere7, sphere8, sphere9 );
410412
@@ -457,32 +459,32 @@ const louisadeTexture = textureLoader.load( 'textures/Louisade.jpg' );
457459
const yabobTexture = textureLoader.load( 'textures/Yabob.jpg' );
458460
459461
gallery = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: introTexture }));
460-
gallery.position.set( 0, gheight, -.75);
462+
gallery.position.set( 0, gheight, sphereposz);
461463
selectedPlane = gallery;
462464
const gallery2 = new THREE.Mesh(new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: keyTexture }));
463-
gallery2.position.set( 1.25, gheight, -.75);
465+
gallery2.position.set( 1.25, gheight, sphereposz);
464466
const gallery3 = new THREE.Mesh(new THREE.PlaneGeometry(psize, psize ), new THREE.MeshBasicMaterial({ map: refTexture }));
465-
gallery3.position.set( -1.25, gheight, -.75);
467+
gallery3.position.set( -1.25, gheight, sphereposz);
466468
467469
scene.add( gallery, gallery2, gallery3);
468470
469471
adzeraG = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: adzeraTexture }));
470-
adzeraG.position.set( 0, gheight, -.75);
472+
adzeraG.position.set( 0, gheight, sphereposz);
471473
472474
aibomG = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: aibomTexture }));
473-
aibomG.position.set( 0, gheight, -.75);
475+
aibomG.position.set( 0, gheight, sphereposz);
474476
475477
mailuG = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: mailuTexture }));
476-
mailuG.position.set( 0, gheight, -.75);
478+
mailuG.position.set( 0, gheight, sphereposz);
477479
478480
dimiriG = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: dimiriTexture }));
479-
dimiriG.position.set( 0, gheight, -.75);
481+
dimiriG.position.set( 0, gheight, sphereposz);
480482
481483
louisadeG = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: louisadeTexture }));
482-
louisadeG.position.set( 0, gheight, -.75);
484+
louisadeG.position.set( 0, gheight, sphereposz);
483485
484486
yabobG = new THREE.Mesh( new THREE.PlaneGeometry( psize, psize ), new THREE.MeshBasicMaterial({ map: yabobTexture }));
485-
yabobG.position.set( 0, gheight, -.75);
487+
yabobG.position.set( 0, gheight, sphereposz);
486488
487489
scene.add( adzeraG, aibomG, mailuG, dimiriG, louisadeG, yabobG);
488490
adzeraG.visible = false;
@@ -493,7 +495,7 @@ louisadeG.visible = false;
493495
yabobG.visible = false;
494496
495497
//the Map
496-
const mapGeometry = new THREE.PlaneGeometry( 3.0 * ratio, 1.5 * ratio );
498+
const mapGeometry = new THREE.PlaneGeometry( 6, 3 );
497499
const mapTexture = textureLoader.load('textures/png.png'); //from google maps
498500
mapTexture.generateMipmaps = true //saves gpu if false
499501
const theMap = new THREE.Mesh( mapGeometry, new THREE.MeshBasicMaterial({ map: mapTexture }));

0 commit comments

Comments
 (0)