Jack_Fog

Untitled

Apr 20th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <body></body>
  2. <script src="http://gamingJS.com/Three.js"></script>
  3. <script src="http://gamingJS.com/ChromeFixes.js"></script>
  4. <script>
  5.   // This is where stuff in our game will happen:
  6.   var scene = new THREE.Scene();
  7.  
  8.   // This is what sees the stuff:
  9.   var aspect_ratio = window.innerWidth / window.innerHeight;
  10.   var camera = new THREE.PerspectiveCamera(75, aspect_ratio, 1, 10000);
  11.   camera.position.z = 500;
  12.   scene.add(camera);
  13.  
  14.   // This will draw what the camera sees onto the screen:
  15.   var renderer = new THREE.CanvasRenderer();
  16.   renderer.setSize(window.innerWidth, window.innerHeight);
  17.   document.body.appendChild(renderer.domElement);
  18.  
  19.   // ******** START CODING ON THE NEXT LINE ********
  20.  
  21. var cover = new THREE.MeshNormalMaterial();
  22. var body  = new THREE.SphereGeometry(100);
  23. var avatar= new THREE.Mesh(body,cover);
  24. scene.add(avatar);
  25.  
  26. var hand = new THREE.SphereGeometry(50);
  27.  
  28. var right_hand = new THREE.Mesh(hand,cover);
  29. right_hand.position.set(-130,0,0);
  30. scene.add(right_hand);
  31.  
  32. var left_hand = new THREE.Mesh(hand,cover);
  33. left_hand.position.set(130,0,0);
  34. scene.add(left_hand);
  35.  
  36. var foot=new THREE.CylinderGeometry(10);
  37.  
  38. var right_foot = new THREE.Mesh(foot,cover);
  39. right_foot.position.set(-30,-120,0);
  40. scene.add(right_foot);
  41.  
  42. var left_foot = new THREE.Mesh(foot,cover);
  43. left_foot.position.set(30,-120,0);
  44. scene.add(left_foot);
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.   // Now, animate what the camera sees on the screen:
  52.   renderer.render(scene, camera);
  53.   function animate() {
  54.   requestAnimationFrame(animate);
  55.   avtar.rotation.z = avatar.rotation.z +0.05;
  56.   renderer.render(scene, camera);
  57.   }
  58.   animate();
  59.   </script>
Advertisement
Add Comment
Please, Sign In to add comment