0

I am trying to create a simple 3D shapes of 3 buildings, assuming I start with the outlines (where I have the X and Y for each line start/end) and then extrude them.

Google did not help me, so I kindly ask you to take a look if you can. I am attaching the lines as an image (just for info).

How can I then make a little dat.GUI switch to turn the shapes on/off (I am not sure how to connect the geometry with the gui).

Thank you!

outlines

Mauricio Poppe
  • 4,817
  • 1
  • 22
  • 30
alex747
  • 139
  • 2
  • 12

1 Answers1

2

A THREE.Mesh is a subclass of THREE.Object3d which defines the property visible, if you don't want to render a mesh just set the property visible to false through an instance of dat.gui

var cube = new THREE.Mesh(geometry, material)
scene.add(cube)

var dat = new dat.GUI()
dat.add(cube, 'visible')

demo

Mauricio Poppe
  • 4,817
  • 1
  • 22
  • 30
  • But how do I make a mesh with the 2d lines illustrated in the image? – alex747 Jun 01 '16 at 23:43
  • Can you post the example. I can realize the solution directly on your example ? – user3410517 Jun 02 '16 at 07:48
  • I do not have an example yet. Imagine you just have some outlines of random buildings and you need to extrude a solid shape/planes from them so they will look 3D. – alex747 Jun 02 '16 at 09:14
  • http://babameca.comlu.com/?run=cuki.js How to make a mesh (or any kind of shape really) for the 3 buildings? – alex747 Jun 03 '16 at 00:08
  • @alex747 you're already creating a 3d object... http://threejs.org/docs/index.html#Reference/Objects/Line is an Object3D, explaining what a mesh (or a line in your case) is and how to build it is outside the scope of this question, why don't you create something on blender and check how it's exported, you will see a collection of vertices and indices that make faces but for a simple line you can assume the above works too – Mauricio Poppe Jun 03 '16 at 01:03
  • @alex747 if you really want to go with just simple lines then the dat.gui callback needs to hide a collection of lines instead of a single line – Mauricio Poppe Jun 03 '16 at 01:09