Post

Replies

Boosts

Views

Activity

Reply to How to create objects based on a list?
Figured it out, this works: for sensor in self.sensors{ node = SCNNode(geometry: SCNSphere(radius: 0.04)) node.geometry?.firstMaterial?.diffuse.contents = UIColor.black node.castsShadow = true node.simdPosition = sensor.getLocation() node.name = "Sensor: \(sensor.getTag())" scene?.rootNode.addChildNode(node) } Sensor is a data class that I wrote, it could be replaced with any other method of assigning a name or position.
Jul ’24
Reply to How to create objects based on a list?
Here is the updated answer: var node: SCNNode let geometry = SCNSphere(radius: 0.04) geometry.firstMaterial?.diffuse.contents = UIColor.black for device in self.devices{ node = SCNNode(geometry: geometry) node.castsShadow = true node.simdPosition = device.getLocation() node.name = "Device: \(device.getTag())" scene?.rootNode.addChildNode(node) }
Jul ’24
Reply to How to set the world alignment to gravity and heading for Roomplan?
Had to move some code around to get it to work. I think the main issue was declaring arSession as a class variable instead of within the initialiser. class RoomCaptureController: RoomCaptureViewDelegate, RoomCaptureSessionDelegate, ObservableObject { var roomCaptureView: RoomCaptureView var sessionConfig: RoomCaptureSession.Configuration init() { roomCaptureView = RoomCaptureView(frame: CGRect(x: 0, y: 0, width: 42, height: 42))//, arSession: arSession) sessionConfig = RoomCaptureSession.Configuration() let arConfig = ARWorldTrackingConfiguration() arConfig.worldAlignment = .gravityAndHeading roomCaptureView.captureSession.arSession.run(arConfig) roomCaptureView.captureSession.delegate = self roomCaptureView.delegate = self } }
Jul ’24