0

I created 2 buttons left and right. if I click left button camera rotate 90 degrees each time. I called leftMode function. my camera rotate does not work. How to do this rotate angle 90 degree?. Please tell, What mistake in my code?

camera3D = new THREE.PerspectiveCamera(angle, width / height, near, far);
camera3D.position.set(0, 10, 500);

/* Floor  */
        var geometry = new THREE.PlaneGeometry(10000, 10000, 10, 10);
        var material = new THREE.MeshBasicMaterial({
            color: 0x444444
        });
        var floor = new THREE.Mesh(geometry, material);
        floor.material.side = THREE.DoubleSide;
        floor.position.set(0, 0, 0);
        floor.rotation.x = Math.PI / 2;
        floor.castShadow = true;
        scene3D.add(floor);

        renderer3D.setClearColor(0x81aff9);
        renderer3D.setSize(width, height);

        controls = new THREE.OrbitControls(camera3D, renderer3D.domElement);
        canvas3D.appendChild(renderer3D.domElement);
        controls.rotateSpeed = 0.75;
        controls.zoomSpeed = 1.2;

this.leftMode = function(){

            console.log(camera3D.rotation);
            console.log(camera3D.position);

            //camera3D.position.x = 500 * Math.cos( 0 );
            //camera3D.position.y = camera3D.position.y;
            //camera3D.position.z = camera3D.position.z;

            //camera3D.rotation.order = (2 * Math.PI) + camera3D.rotation.x;

            //camera3D.position.x = (2 * Math.PI) + camera3D.rotation.x;

            camera3D.rotation.x = camera3D.rotation.x + 90*Math.PI/180;
        }
karthick187
  • 61
  • 13

0 Answers0