-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
in this page i have 5 issues cal:
1- Cannot assign value of type 'SessionSettings.Type' to type 'SessionSettings'
2- Cannot call value of non-function type 'Bool'
3- Cannot infer contextual base in reference to member 'mesh'
4- Cannot call value of non-function type 'ARView.Environment.SceneUnderstanding.Options'
5- Cannot infer contextual base in reference to member 'occlusion'
`
import RealityKit
import ARKit
import FocusEntity
import SwiftUI
import Combine
class CustomARView: ARView {
var focusEntity: FocusEntity?
var sessionSettings: SessionSettings
private var peopleOcclusionCancellable: AnyCancellable?
private var objectOcclusionCancellable: AnyCancellable?
private var lidarDebugCancellable: AnyCancellable?
private var multiuserCancellable: AnyCancellable?
required init(frame frameRect: CGRect, sessionSettings: SessionSettings) {
self.sessionSettings = SessionSettings
super.init(frame: frameRect)
focusEntity = FocusEntity(on: self, focus: .classic)
configure()
self.initializeSettings()
self.setupSubscribers()
}
required init(frame frameRect: CGRect) {
fatalError("init(frame:) has not been implemented")
}
@objc required dynamic init?(coder decoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
private func configure() {
let config = ARWorldTrackingConfiguration()
config.planeDetection = [.horizontal, .vertical]
if ARWorldTrackingConfiguration.supportsAppClipCodeTracking(.mesh) {
config.sceneReconstruction = .mesh
}
session.run(config)
}
private func initializeSettings() {
self.updatePeopleOcclusion(isEnabled: sessionSettings.isPeopleOcclusionEnabled)
self.updateObjectOcclusion(isEnabled: sessionSettings.isObjectOcclusionEnabled)
self.updateLidarDebug(isEnabled: sessionSettings.isLidarDebugEnabled)
self.updateMultiuser(isEnabled: sessionSettings.isMultiuserEnabled)
}
private func setupSubscribers() {
self.peopleOcclusionCancellable = sessionSettings.$isPeopleOcclusionEnabled.sink { [weak self] isEnabled in
self?.updatePeopleOcclusion(isEnabled: isEnabled)
}
self.objectOcclusionCancellable = sessionSettings.$isObjectOcclusionEnabled.sink { [weak self] isEnabled in
self?.updateObjectOcclusion(isEnabled: isEnabled)
}
self.lidarDebugCancellable = sessionSettings.$isLidarDebugEnabled.sink { [weak self] isEnabled in
self?.updateLidarDebug(isEnabled: isEnabled)
}
self.multiuserCancellable = sessionSettings.$isMultiuserEnabled.sink { [weak self] isEnabled in
self?.updateMultiuser(isEnabled: isEnabled)
}
}
private func updatePeopleOcclusion(isEnabled: Bool) {
print("\(#file): isPeopleOcclusionEnabled is now \(isEnabled)")
guard ARWorldTrackingConfiguration.supportsFrameSemantics(.personSegmentationWithDepth) else {
return
}
guard let configuration = self.session.configuration as? ARWorldTrackingConfiguration else {
return
}
if configuration.frameSemantics.contains(.personSegmentationWithDepth) {
configuration.frameSemantics.remove(.personSegmentationWithDepth)
} else {
configuration.frameSemantics.insert(.personSegmentationWithDepth)
}
self.session.run(configuration)
}
private func updateObjectOcclusion(isEnabled: Bool) {
print("\(#file): isObjectOcclusionEnabled is now \(isEnabled)")
if self.environment.sceneUnderstanding.options(.occlusion) {
self.environment.sceneUnderstanding.options.remove(.occlusion)
} else {
self.environment.sceneUnderstanding.options.insert(.occlusion)
}
}
private func updateLidarDebug(isEnabled: Bool) {
print("\(#file): isLidarDebugEnabled is now \(isEnabled)")
if self.debugOptions.contains(.showSceneUnderstanding) {
self.debugOptions.remove(.showSceneUnderstanding)
} else {
self.debugOptions.insert(.showSceneUnderstanding)
}
}
private func updateMultiuser(isEnabled: Bool) {
print("\(#file): isMultiuserEnabled is now \(isEnabled)")
}
}`
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels