3DNGuy

Members
  • Content count

    2
  • Joined

  • Last visited

  1. 3DNGuy

    Merging with Three.JS

    Yeah a number nights of searching Still having problems. Thanks though
  2. 3DNGuy

    Merging with Three.JS

    Hey, i'm in the process of learning three.js. I am currently trying to merge two meshes together to to build a movable lego brick. I'm working inside the three.js editor Mr Doob created and using the brick.js module mattmatchell did. Below is some sample code of what i'm working with. I have tried many iterations of merging the component pieces and adding them to the scene but i'm just missing something. Any hints on how to set this up? If you need more info i'll be happy to add to this. Just need a nudge over this bump. Thanks for the help! BRICK.square=function(colorCode, w, d, h){ w = w || 1; h = h || 3; d = d || 1; THREE.Object3D.call( this ); var faceMaterial = new THREE.MeshLambertMaterial({color: BRICK.color(colorCode).face}); var mesh=new THREE.Mesh(new THREE.CubeGeometry(20*w,8*h,20*d), faceMaterial); mesh.position.y=(8*h)/2; mesh.matrixAutoUpdate = true; mesh.updateMatrix(); this.add(mesh); for(var i=1; i<=w; i++){ for(var j=1; j<=d; j++){ var stud=new THREE.Mesh(new THREE.CylinderGeometry(6,6, 4, 32, 4), faceMaterial); stud.position.y=(8*h)+2; stud.position.x=(i*20)-((w*20)/2)-10; stud.position.z=(j*20)-((d*20)/2)-10; stud.matrixAutoUpdate = false; stud.updateMatrix(); this.add(stud); } } }