tham_kathy Posted September 7, 2018 Share Posted September 7, 2018 This is a picture of two rooms. Each room has separate walls. I want to join the walls and make them as one. There should be only one wall in between two rooms. Appreciate your help.! Quote Link to comment Share on other sites More sharing options...
Guest Posted September 7, 2018 Share Posted September 7, 2018 You can call Mesh.MergeMeshes (http://doc.babylonjs.com/how_to/how_to_merge_meshes) to merge two meshes but perhaps you could also have a look to CSG? (https://www.babylonjs-playground.com/#T6NP3F#0) tham_kathy 1 Quote Link to comment Share on other sites More sharing options...
tham_kathy Posted September 8, 2018 Author Share Posted September 8, 2018 Actually I want to find the area of rectangle intersection. I want to remove that and make it as one wall line. Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 8, 2018 Share Posted September 8, 2018 You can remove with CSG using subtract(). If you add overlapping areas they will be merged: https://www.babylonjs.com/demos/csg/ It looks like you could subtract the 2 parts separately to have each room as it's own mesh and then merge overlapping. Finding area of intersection I will leave up to you, unless you want to create a playground, but I would imagine the wall depth is known, so you can work from that by repositioning the second room before merging. When I started I spent more time in CSG than 3d modeling, but you should consider also fixing/splitting the 3D model into submeshes! tham_kathy 1 Quote Link to comment Share on other sites More sharing options...
tham_kathy Posted September 10, 2018 Author Share Posted September 10, 2018 This is what I get when I substract 2 rooms. Or is there a way to hide the lines that separate two rooms? Or is it possible to merge those two meshes from 0.5cm without changing their original positions? Then there will be only one wall in between two rooms. I'm very new to this 3D stuff so plz help me to find a solution Quote Link to comment Share on other sites More sharing options...
brianzinn Posted September 10, 2018 Share Posted September 10, 2018 1 hour ago, tham_kathy said: Or is it possible to merge those two meshes from 0.5cm without changing their original positions? I don't know a way to merge meshes without updating positions. If you can make a playground then I can possibly provide a solution - you haven't provided any code or model, so it's hard for me to imagine what you have tried or to propose a solution. Maybe somebody else can help without a 3D model or code though? tham_kathy 1 Quote Link to comment Share on other sites More sharing options...
tham_kathy Posted September 10, 2018 Author Share Posted September 10, 2018 On 9/10/2018 at 10:29 AM, brianzinn said: I don't know a way to merge meshes without updating positions. If you can make a playground then I can possibly provide a solution - you haven't provided any code or model, so it's hard for me to imagine what you have tried or to propose a solution. Maybe somebody else can help without a 3D model or code though? This is the html file of my code. Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 10, 2018 Share Posted September 10, 2018 Easiest way is to only use buildFromPlan for outer walls and then use boxes and adjust position according to outer wall measurements https://www.babylonjs-playground.com/#WKMCNK tham_kathy 1 Quote Link to comment Share on other sites More sharing options...
tham_kathy Posted September 10, 2018 Author Share Posted September 10, 2018 @JohnK Actually what I'm doing is creating houses at run time by reading the given floor plan. I get an array of coordinates by reading the floor plan and I'm passing the array values to the buildFromPlan method. I don't find any method which I can used to automate this process for the number of rooms. If I use your suggestion, I have no idea how give values for the positions. Anyway, thanks a lot.! Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 10, 2018 Share Posted September 10, 2018 In my mind the interior walls should appear on the floor plan, hence their x and z coordinates are apparent, the rest can be calculated from there. Actually I have a bit of time on my hands I will look at automating over the next couple of days. tham_kathy 1 Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 11, 2018 Share Posted September 11, 2018 Here we go, have re-written the buildFromPlan function and now you can use an interior: true within the options. This builds one or more walls that do not join end to start. After building the main walls you can add interior walls by giving positional coordinates, based on the base data. As the walls are given thickness in the direction away from the origin if you find the depth of the wall is on the wrong side just reverse the corner coordinates in the array, ie [4, 2, 4, 8] becomes [4, 8, 4,2]. Here are some of examples http://www.babylonjs-playground.com/#P3N8ZF#1 http://www.babylonjs-playground.com/#P3N8ZF#2 http://www.babylonjs-playground.com/#P3N8ZF#3 Doors and windows should work but have yet to try that. tham_kathy 1 Quote Link to comment Share on other sites More sharing options...
tham_kathy Posted September 11, 2018 Author Share Posted September 11, 2018 ?@JohnK Thanks a looot.. ? U saved my life ?? Quote Link to comment Share on other sites More sharing options...
JohnK Posted September 11, 2018 Share Posted September 11, 2018 Doors work OK if you need them. A bungalow http://www.babylonjs-playground.com/#1Z71FW#4 based on this one (very loosley) Arte, brianzinn and tham_kathy 1 2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.