Hi all
I want to know if it is possible to adjust the vertices of the edge in each wall to correct the overlapping or gap between 2 walls. I have checked this doc: Developing Build a House from Plans | Babylon.js Documentation but I could not apply to the pg
The main difference is that you use only boxes whereas the doc is manipulating vertices to build walls doors windows and such. I would suggest to stick to the doc approach which will prevent having to reconcile edges like this.
You can get the vertex array by doing mesh.getVerticesData("position") but you will have to find which vertices correspond to the corner(s) and update their coordinates yourself, by applying some maths calculation. Once the array is updated, you can set the new vertices on the mesh by doing mesh.setVerticesData("position", newarray).
The positions array of a mesh you make using .createBox will have 8 sets of 3 equal vector3 coordinates that correspond to each corner of the 6 faces. And you can move the corners by updating each all 3 coordinates.
If you want to have arbitrary angles to your walls and have the corners be clean it will be MUCH easier in my opinion to forget about transform (scaling rotation and position) and use world coordinates for the corners of all your walls and figure out what the world coordinate are using plane math.
If you’re curious about this approach let me know and I can make a playground to demo what this looks like.
If someone wants to clean this up I’d be grateful. This is to get a normal then add scaling for the inside angle between to walls so the depth setback for the inside corners is correct:
Cool!! I am trying to figure out how to take this concept and dynamically create walls as I click on the ground. I should also consider creating outer walls and inner walls. Furthermore, I cannot see the top and bottom faces of the mesh.