Michaël
Michaël

Reputation: 609

Three.js mesh doesn't appear with the build version of the library but appears when using old ones library?

I want to use the build version of three.js (https://threejs.org/build/three.js) for a project.

I was using an old one version of the library and everything was fine and my mesh (loaded form a .json file) appeared normally.

Here's my code :

    var renderer, scene, camera, mesh, material;

    initMesh();

    function initMesh() {

        var controls;

        camera = new THREE.PerspectiveCamera( 50, window.innerWidth / window.innerHeight, 1, 10000 );
        camera.position.set(0,500,700);
        camera.up = new THREE.Vector3(0,0,0);
        camera.lookAt(new THREE.Vector3(0,0,0));

        scene = new THREE.Scene();
        scene.add(camera);

        renderer = new THREE.WebGLRenderer();
        renderer.setSize( window.innerWidth, window.innerHeight );
        document.body.appendChild( renderer.domElement );

        var loader = new THREE.JSONLoader();
        loader.load('test.json', function(geometry) {

            material = new THREE.MeshBasicMaterial({ color: 0x00ff84, wireframe: true, wireframeLinewidth: 3 });
            mesh = new THREE.Mesh(geometry, material);
            scene.add(mesh);

            render();

        });
    }

    var render = function () {
        requestAnimationFrame( render );

        renderer.render(scene, camera);
    };

Here is what I got when using old one library.

I don't see what I miss ? Any idea ? Thank you.

Upvotes: 0

Views: 49

Answers (1)

Soufiane Lasri
Soufiane Lasri

Reputation: 170

I tried with your example
Removing this line fixed the issue: camera.up = new THREE.Vector3(0,0,0);

Upvotes: 1

Related Questions