Creating walls by forming faces using specific points is a successful process for me. However, I am now looking to add thickness to these walls, and I am unsure of the best approach.
Below is the code I currently use to create the walls:
makeWall(start, end) {
let v1 = this.helpers.toVec3(start); //0
let v2 = this.helpers.toVec3(end); //1
let v3 = v2.clone(); //2
v3.y = this.wallHeight;
let v4 = v1.clone(); //3
v4.y = this.wallHeight;
let points = [ v1.clone(), v2.clone(), v3.clone(), v4.clone() ];
console.log("Points", points )
let mesh:THREE.Mesh;
let geometry = new THREE.Geometry();
let label: THREE.Sprite;
let walldirection;
geometry.vertices = [v1, v2, v3, v4];
geometry.faces.push(new THREE.Face3(0, 1, 2));
geometry.faces.push(new THREE.Face3(0, 2, 3));
geometry = this.helpers.assignUVs(geometry);
mesh = new THREE.Mesh(geometry, this.wallMaterial);
...
}
Once the walls are created, they come together to form a closed room. Here is an example of the points:
(4) [p, p, p, p]
0: p {x: 200, y: 0, z: -500}
1: p {x: 200, y: 0, z: 300}
2: p {x: 200, y: 277, z: 300}
3: p {x: 200, y: 277, z: -500}
length: 4
Thank you for your assistance.
Update// I believe I am making progress in the right direction. I have added 4 additional points with an offset and created faces for them. However, I am encountering an issue. Could it be related to the faces being incorrect?
let v1ex = v1.clone(); // 4
v1ex.x = v1ex.x - 10;
let v2ex = v2.clone(); // 5
v2ex.x = v1ex.x + 10;
let v3ex = v3.clone(); // 6
v3ex.x = v3ex.x + 10;
let v4ex = v4.clone(); // 7
v4ex.x = v4ex.x - 10;
let points = [ v1.clone(), v2.clone(), v3.clone(), v4.clone() , v1ex , v2ex , v3ex , v4ex ];
let mesh:THREE.Mesh;
let geometry = new THREE.Geometry( );
let label: THREE.Sprite;
let walldirection;
geometry.vertices = [v1, v2, v3, v4 , v1ex , v2ex , v3ex , v4ex];
geometry.faces.push(new THREE.Face3( 0 , 1 , 2 ) );
geometry.faces.push(new THREE.Face3( 0 , 2 , 3 ) );
geometry.faces.push(new THREE.Face3( 4 , 5 , 6 ) );
geometry.faces.push(new THREE.Face3( 4 , 6 , 7 ) );
geometry.faces.push(new THREE.Face3( 7 , 3 , 6 ) );
geometry.faces.push(new THREE.Face3( 7 , 3 , 2 ) );
geometry.faces.push(new THREE.Face3( 0 , 5 , 1 ) );
geometry.faces.push(new THREE.Face3( 0 , 5 , 4 ) );