Browse Source

better room dimensions

master
Peter Hajas 3 years ago
parent
commit
676d7b42d6
  1. 46
      data.json
  2. 4
      script.js

46
data.json

@ -1,40 +1,34 @@
{ {
"rooms" : [ "rooms" : [
{ {
"name" : "Great Room", "name" : "Patio",
"x" : 4.9784, "x" : 0, "y" : 0.6096,
"y" : 0, "w" : 4.9774, "h" : 4.6736, "d" : 3.048,
"w" : 5.385, "color" : "green"
"h" : 4.37,
"d" : 6.096,
"color" : "yellow"
}, },
{ {
"name" : "Dining Room", "name" : "Dining Room",
"x" : 0, "x" : 0, "y" : 5.2832,
"y" : 4.6736, "w" : 4.9774, "h" : 3.7338, "d" : 3.048,
"w" : 4.9774,
"h" : 3.7338,
"d" : 3.048,
"color" : "red" "color" : "red"
}, },
{
"name" : "Patio",
"x" : 0,
"y" : 0.6096,
"w" : 4.9774,
"h" : 4.6736,
"d" : 3.048,
"color" : "green"
},
{ {
"name" : "Stairway", "name" : "Stairway",
"x" : 0, "x" : 0, "y" : 9.017,
"y" : 7.7216, "w" : 2.9972, "h" : 3.149, "d" : 6.096,
"w" : 2.9972,
"h" : 3.149,
"d" : 6.096,
"color" : "blue" "color" : "blue"
},
{
"name" : "Office",
"x" : 0, "y" : 12.166,
"w" : 3.5179, "h" : 3.8608, "d" : 3.048,
"color" : "orange"
},
{
"name" : "Great Room",
"x" : 4.9784, "y" : 0,
"w" : 5.385, "h" : 4.37, "d" : 6.096,
"color" : "yellow"
} }
] ]
} }

4
script.js

@ -30,8 +30,8 @@ animate();
function setPosition(mesh, x, y, z, w, h, d) { function setPosition(mesh, x, y, z, w, h, d) {
// position sets the *center* position // position sets the *center* position
// our coordinates are top/left/bottom // our coordinates are top/left/bottom
let meshX = x - w/2 let meshX = x + w/2
let meshY = y - h/2 let meshY = y + h/2
let meshZ = z - d/2 let meshZ = z - d/2
mesh.position.x = meshX mesh.position.x = meshX
mesh.position.y = meshY mesh.position.y = meshY

Loading…
Cancel
Save