I have encountered an issue while adding a cube to my scene using THREE.JS. When I try to change the height of the cube by increasing its y coordinate, it also seems to expand in the negative y direction as well.
var cubeGeometry2 = new THREE.BoxGeometry(10, 25, 5);
var cubeMaterial2 = new THREE.MeshBasicMaterial({
color: '#5A5A5A',
wireframe: false
});
var cube3 = new THREE.Mesh(cubeGeometry2, cubeMaterial2);
console.log(cubeGeometry2)
cube3.position.set(25, 5.5, -12);
scene.add(cube3);
To adjust the scale of the cube, I have been increasing the y coordinate in the box geometry constructor
Solution Edit
Despite taking an unconventional approach, here is how I managed to solve it:
//First look into the vertices by
console.log(cubeGeometry2)
//Changed all the occurrences of Y vertices to positive values by looping through the vertices list
for(let i = 0;i < cube3.geometry.vertices.length;i++){
if(cube3.geometry.vertices[i].y < 0){
cube3.geometry.vertices[i].y = cube3.geometry.vertices[i].y * 0
}
}