javascriptthree.jsgeometrythickness

Three.js, adding thickness to mesh geometry triangle


I'm new to three.js.

I draw a simple triangle with this. But how can I make it 1 height of thickness, instead of plane geometry?

var triangleGeometry = new THREE.Geometry(); 
triangleGeometry.vertices.push(new THREE.Vector3( 0.0,  1.0, 0.0)); 
triangleGeometry.vertices.push(new THREE.Vector3(-1.0, -1.0, 0.0)); 
triangleGeometry.vertices.push(new THREE.Vector3( 1.0, -1.0, 0.0)); 
triangleGeometry.faces.push(new THREE.Face3(0, 1, 2));
var triangleMaterial = new THREE.MeshBasicMaterial({ color:0xFFFFFF, side:THREE.DoubleSide }); 
var triangleMesh = new THREE.Mesh(triangleGeometry, triangleMaterial); 
triangleMesh.position.set(-1.5, 0.0, 4.0); 
scene.add(triangleMesh); '

Thank you.


Solution

  • We need to add all faces of the triangle. 6 vertices for all points and 8 faces for all 4 faces. Beware of the order.