3d position + plane

by Master P

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/three.js/94/three.min.js"></script>
<!-- My scene -->
<canvas id="scene"></canvas>

<!--

JavaScript

//Get the height and the width of the window

     var scene, camera, renderer;
     var geometry, material, mesh;

     var ww = window.innerWidth;
     var wh = window.innerHeight;

     function init() {

       /* WEBGL RENDERER */

       //Create the webGl renderer from Three
       renderer = new THREE.WebGLRenderer({
         canvas: document.getElementById('scene')
       });
       //Set the background of our scene
       renderer.setClearColor(0x3F3F3F);
       //Set the size of my renderer, I want it to be fullscreen
       renderer.setSize(ww, wh - 50);


       //Create my scene
       scene = new THREE.Scene();

       /* CAMERA */

       camera = new THREE.PerspectiveCamera(50, ww / wh, 1, 2000);
       //We set our camera at x:0,y:0 and z:1000
       camera.position.set(0, 0, 1000);
       //And finally we add our camera in our scene
       scene.add(camera);

       /* LIGHT */

       //Create a white 'directional light'
       light = new THREE.DirectionalLight(0xffffff, 1);
       //We the position of our light
       light.position.set(50, 250, 1000);
       //We add our light into the scene
       scene.add(light);


       /* The Cube */

       //We create a boxGeometry with three parameters: width, height and depth
       geometry = new THREE.BoxGeometry(200, 200, 200);

       //We create a texture for our cube, here it's only a red texture
       material = new THREE.MeshLambertMaterial({
         color: 0x00ff00
       });

       //We create the Mesh which contains our geometry (the cube) and its texture
       mesh = new THREE.Mesh(geometry, material);
       
             

      // mesh.position.set(-(window.innerWidth - 100), (window.innerHeight - 100), 0);
       //Rotate a bit the cube to see it's in 3D (don't dorget it's in radian)
       //mesh.rotation.y = Math.PI / 4;
       //mesh.rotation.x = Math.PI / 4;

       //And finally we add the cube to our scene
       scene.add(mesh);


       //This is very important, it will...