JavaScript How to point isometric camera to the center of cube in THREE.js?

I am struggling with an excercise question and maybe you could help me. I have to set up a camera and cube with THREE.js. The cube should keep its initial ratio and the camera should look at the center of the cube. I think I managed to do a isometric projection but I can't figure out how to point the camera to the centre.

Here's what I have tried:

<!DOCTYPE html>
 <html>

 <head>
<meta charset=utf-8>
<title>Cube</title>
<style>

</style>
</head>

<body>
<script src="js/three.min.js"></script>
<script>
        var scene = new THREE.Scene();
        var camera = new THREE.OrthographicCamera(-3,3,3,-3, 0, 100);


        var ambientLight = new THREE.AmbientLight(0x222222);
        scene.add(ambientLight);
        var light = new THREE.PointLight( 0xffffff );
        light.position.set(-10, 10, 10);
        scene.add(light);
        var renderer = new THREE.WebGLRenderer();
        renderer.setSize(800,800);

        document.body.appendChild(renderer.domElement);

        var geometry = new THREE.BoxGeometry(1,1,1);
        var cube = new THREE.Mesh(geometry, new THREE.MeshLambertMaterial( { color: 0x00ffff }));
        scene.add( cube );

  function render() { //this is to be used for animation later
  requestAnimationFrame(render);
        camera.position.x=1;
        camera.position.y=1;
        camera.position.z=1;

        camera.lookAt(new THREE.Vector3(0,0,0));
        renderer.render( scene, camera);

        }
 render();
</script>

Answer:1

For the CMS page editor in Magento,i would like to change the formatting of the H tags in the tinyMce editor. I would like something like for H1 tag, it is in red, bold, font:36px. how would i go ...

For the CMS page editor in Magento,i would like to change the formatting of the H tags in the tinyMce editor. I would like something like for H1 tag, it is in red, bold, font:36px. how would i go ...

Does anyone know why the height could be zero here? $(document).ready(function () { alert($("#hello").height()); }); <script src="https://ajax.googleapis.com/ajax/...

Does anyone know why the height could be zero here? $(document).ready(function () { alert($("#hello").height()); }); <script src="https://ajax.googleapis.com/ajax/...

  1. jquery element height returns 0
  2. element height returns 0
  3. jquery height returns 0
  4. jquery div height returns 0

I'm thinking using S3 Amazon for storage (if you guys have better one, don't hesitate to recommend). I could do a normal file upload, but let's say I'm uploading a very large video/music file (...

I'm thinking using S3 Amazon for storage (if you guys have better one, don't hesitate to recommend). I could do a normal file upload, but let's say I'm uploading a very large video/music file (...

  1. google cloud storage multipart upload

I'm trying to select the data that comes from the data base with jQuery, but my problem is that only the first result has a click handler bound to it. Here is the PHP part: <?php $sql = "SELECT ...

I'm trying to select the data that comes from the data base with jQuery, but my problem is that only the first result has a click handler bound to it. Here is the PHP part: <?php $sql = "SELECT ...