I am creating an app with swift that is using Apple’s RoomPlan, but I am trying to set the orientation to the gravityAndHeading option. I am trying to create a custom ARSession and pass it into my RoomPlanSession in order to change the orientation, but it is not working.
class RoomCaptureController: RoomCaptureViewDelegate, RoomCaptureSessionDelegate, ObservableObject
{
var roomCaptureView: RoomCaptureView
private var arSession: ARSession
private var arConfig: ARWorldTrackingConfiguration
var sessionConfig: RoomCaptureSession.Configuration
init() {
let arConfig = ARWorldTrackingConfiguration()
arConfig.worldAlignment = .gravityAndHeading
arSession = ARSession()
roomCaptureView = RoomCaptureView(frame: CGRect(x: 0, y: 0, width: 42, height: 42)) arSession: arSession)
sessionConfig = RoomCaptureSession.Configuration()
roomCaptureView.captureSession.delegate = self
roomCaptureView.delegate = self
}
Above is my current code, but I get an issue about self being used before all variables are declared at the line where roomCaptureView is assigned.
If I run it without the custom ARSession, my code works.
How can I fix it?
Echo31416 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.