I have utilized JavaScript, CSS, and Three.js to create a 3D model.
The project comprises a total of 5 JS files, 1 CSS file, and 1 HTML file.
Here is an overview of the model:
[]
Showers have been incorporated for each cubicle, which should only be visible when the user selects the checkbox corresponding to a specific cubicle.
For example, if the user ticks the 'cubicle 1 checkbox', the shower should appear in cubicle 1.
Below is a relevant segment of code from the responsible JavaScript file:
function createPartition() {
// Code snippet here...
}
// Additional section of code related to adding showers
shower = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.11, 0.45), wallMaterial);
showerhead = new THREE.Mesh(new THREE.BoxGeometry(0.1, 0.1, -0.04), wallMaterial);
partitionLeft.add(shower);
partitionLeft.add(showerhead);
// Positioning of elements
shower.position.set(0.4, 0.5, -1.312);
showerhead.position.set(0.4, 0.4, -1.112);
The checkboxes' values are defined in the index.html file:
<input type="checkbox" name="cube1" value="cube1"> Cubicle 1 <br>
<input type="checkbox" name="cube2" value="cube2" checked> Cubicle 2 <br>
Does anyone have any suggestions on how to display the 'shower' when a specific checkbox is selected by the user?