1// Set up the game2functioninit(){34/*
5 // load the dino JSON model and start animating once complete
6 loader.load('https://s3-us-west-2.amazonaws.com/s.cdpn.io/515428/dino.json', function (geometry, materials) {
789 // Get the geometry and materials from the JSON
10 var dinoObject = new THREE.Mesh(geometry, new THREE.MultiMaterial(materials));
1112 // Scale the size of the dino
13 dinoObject.scale.set(DINOSCALE, DINOSCALE, DINOSCALE);
14 dinoObject.rotation.y = degreesToRadians(180);
15 dinoObject.position.set(30, 0, -400);
16 dinoObject.name = "dino";
17 scene.add(dinoObject);
1819 //position.setFromMatrixPosition(dino.matrixWorld);
20 dino = scene.getObjectByName("dino");
2122 // Model is loaded, switch from "Loading..." to instruction text
23 instructions.innerHTML = "<strong>Click to Play!</strong> </br></br> W,A,S,D or arrow keys = move </br>Mouse = look around";
2425 // Call the animate function so that animation begins after the model is loaded
26 animate();
27 });
28*/29// Call the animate function so that animation begins after the model is loaded30animate();313233}
js
1functionanimate(){2render();3requestAnimationFrame(animate);45// Get the change in time between frames6var delta = clock.getDelta();7// Update our frames per second monitor89/*
10 // If the player is in dino's range, trigger the chase
11 var isBeingChased = triggerChase();
12 // If the player is too close, trigger the end of the game
13 if (dino.position.distanceTo(controls.getObject().position) < CATCHOFFSET) {
14 caught();
15 // Player is at an undetected distance
16 // Keep the dino moving and let the player keep moving too
17 } else {
18 animateDino(delta);
19 animatePlayer(delta);
20 }
21*/22animatePlayer(delta);23}
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/09/02 01:40
2018/09/02 07:10
2018/09/02 08:34
2018/09/02 11:10 編集
2018/09/02 16:40