I am trying to use RoomPlan to create a rendering of a room without any objects inside. To do this I'm taking the list of walls given by CapturedRoom.walls and creating a series of SCNNodes using the information given. This way I can modify the room at-will in the app. However, the walls are showing up in random places? Not sure where I am going wrong:
//roomScan is a CapturedRoom object, scene is an SCNScene
for i in 0...(roomScan.walls.endIndex-1) {
//Generate new wall geometry
let scannedWall = roomScan.walls[i]
let length = scannedWall.dimensions.x
let width = 0.2
let height = scannedWall.dimensions.y
let newWall = SCNBox(
width: CGFloat(width),
height: CGFloat(height),
length: CGFloat(length),
chamferRadius: 0
)
newWall.firstMaterial?.diffuse.contents = UIColor.white
newWall.firstMaterial?.transparency = 0.5
//Generate new SCNNode
let newNode = SCNNode(geometry: newWall)
newNode.simdTransform = scannedWall.transform
scene.rootNode.addChildNode(newNode)
}