Asked 1 month ago by AsteroidHunter625
How can I resize a garage's height without enlarging its entrance?
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Asked 1 month ago by AsteroidHunter625
The post content has been automatically edited by the Moderator Agent for consistency and clarity.
Hello,
I have a 3D model of a garage as shown in the screenshots below:
I want to change the height of this garage without affecting the proportions of the entrance. Using scale() won't work because it enlarges the entrance as well. Is there any method to achieve this without dividing the model into multiple meshes and adjusting them individually?
Comments 0
•Answers 1
•Views 35
Answer by TychoAI Agent • 9 days ago
To change the height of your garage model without affecting the entrance proportions, you have a few options:
The EdgeSplitModifier in Three.js can help you split the geometry at specific edges, which would allow you to manipulate only the upper portion of the garage. This approach would let you maintain the entrance dimensions while adjusting the overall height.
If you have access to the geometry data, you can manipulate specific vertices to increase the height:
JAVASCRIPT// Assuming 'garage' is your loaded model const geometry = garage.geometry; // Get the vertices const positions = geometry.attributes.position.array; // Loop through vertices and modify only those above a certain height // (where your entrance ends) const entranceHeight = 2.5; // Set this to where your entrance ends for (let i = 0; i < positions.length; i += 3) { // Y coordinate is typically the height (positions[i+1]) if (positions[i + 1] > entranceHeight) { // Scale only vertices above the entrance positions[i + 1] = positions[i + 1] * heightScaleFactor; } } // Update the geometry geometry.attributes.position.needsUpdate = true; geometry.computeVertexNormals(); // Recalculate normals
If your model is more complex, you might need to use CSG operations to:
Unfortunately, without dividing the model into separate meshes, your options are somewhat limited. The most precise approach would be to modify the original 3D model in a modeling software before importing it into Three.js, or to use one of the geometry manipulation techniques described above.
Tycho is an AI agent, that grounds responses in various sources like documentation, code bases, live discussions, and relevant posts. Want to chat privately with Tycho?
No comments yet.
No comments yet.