Home>

I want to display only the maze with the code of Three.js linked below, but it doesn't work well,
I want to make it simple by displaying only the 3D maze, removing everything that is not related to the maze display. (I don't need a dinosaur ...)

Please tell me where to erase and where to remove.

Here is the code.
https://codepen.io/MSEdgeDev/pen/NpKejy
https://docs.microsoft.com/en-us/windows/uwp/get-started/get-started-tutorial-game-js3d

I think there are many other ways to write a maze,
I thought that the most efficient way to write a 3D maze with only 1, 0 was.
I looked for an explanation on the English site, but I couldn't find it for now.

  • Answer # 1

    loader.loadis the dinosaur model loading part. Since existing code callsanimate ()after loading is completed, if you do not load the model, callanimate ()separately. is needed.
    Also, if you do not load the dinosaur model, please comment out the call toanimateDino ()because it is unnecessary.

    // Set up the game
    function init () {
    / *
        // load the dino JSON model and start animating once complete
        loader.load ('https://s3-us-west-2.amazonaws.com/s.cdpn.io/515428/dino.json', function (geometry, materials) {
            // Get the geometry and materials from the JSON
            var dinoObject = new THREE.Mesh (geometry, new THREE.MultiMaterial (materials));
            // Scale the size of the dino
            dinoObject.scale.set (DINOSCALE, DINOSCALE, DINOSCALE);
            dinoObject.rotation.y = degreesToRadians (180);
            dinoObject.position.set (30, 0, -400);
            dinoObject.name = "dino";
            scene.add (dinoObject);
            //position.setFromMatrixPosition(dino.matrixWorld);
            dino = scene.getObjectByName ("dino");
            // Model is loaded, switch from "Loading ..." to instruction text
            instructions.innerHTML = "<strong>Click to Play!</strong></br></br>W, A, S, D or arrow keys = move</br>Mouse = look around" ;
            // Call the animate function so that animation begins after the model is loaded
            animate ();
        });
    * /
        // Call the animate function so that animation begins after the model is loaded
        animate ();
    }
    function animate () {
        render ();
        requestAnimationFrame (animate);
        // Get the change in time between frames
        var delta = clock.getDelta ();
        // Update our frames per second monitor
    / *
        // If the player is in dino's range, trigger the chase
        var isBeingChased = triggerChase ();
        // If the player is too close, trigger the end of the game
        if (dino.position.distanceTo (controls.getObject (). position)<CATCHOFFSET) {
            caught ();
        // Player is at an undetected distance
        // Keep the dino moving and let the player keep moving too
        } else {
            animateDino (delta);
            animatePlayer (delta);
        }
    * /
        animatePlayer (delta);
    }