Skip to content
Permalink
Browse files
Add an obstacle
  • Loading branch information
MattyRad committed Feb 8, 2020
1 parent 6acaa47 commit 3dd9fad9bd0b40b7b7f668c91f9846642b3e0e45
Showing 1 changed file with 8 additions and 0 deletions.
@@ -5,11 +5,19 @@ var renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );

// player
var geometry = new THREE.BoxGeometry( 0.2, 1, 0.2 );
var material = new THREE.MeshBasicMaterial( { color: 0x00ff00 } );
var player = new THREE.Mesh( geometry, material );
scene.add( player );

// obstacle
var geometry = new THREE.BoxGeometry( 0.2, 1, 0.2 );
var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
var obstacle = new THREE.Mesh( geometry, material );
obstacle.position.x += 1;
scene.add( obstacle );

camera.position.z = 5;

var animate = function () {

0 comments on commit 3dd9fad

Please sign in to comment.