maxxfrazer / FocusEntity

Bringing the scanning box from SceneKit to RealityKit

Home Page:https://maxxfrazer.github.io/FocusEntity/documentation/focusentity/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problems when using Collaborative session

daragonor opened this issue · comments

Hi man, your repo and your work is awesome.

I tried using your code on a collaborative session project, as soon as another phone connected and added the entity to the session, it would break on the previous phones due to not finding an appropriate init

I would suggest to add the the option to disable synchronizing, or to put it off completely (since the focusing feature works around only one screen)

i tried running this on your code

  public required init(on arView: ARView, focus: FocusEntityComponent) {
    self.arView = arView
    super.init()
    self.focus = focus
    self.name = "FocusEntity"
    self.orientation = simd_quatf(angle: .pi / 2, axis: [1, 0, 0])
    self.positioningEntity.synchronization = nil
    self.addChild(self.positioningEntity)
    cameraAnchor = AnchorEntity(.camera)
    cameraAnchor.synchronization = nil
    synchronization = nil
    arView.scene.addAnchor(cameraAnchor)

because I was in a hurry to get this out, i didnt test this to see if only one of the = nil on the synchronization components where required, but that did it for me

I think the best solution for this would be improving the class structure in the repo. Just setting the main class's sync to nil would do the trick. The position would likely be messed up if it's synched across devices too, as it's based on world space rather than anchors

can you share any example/sample code for this?

To set the sync to nil: focusEntity.synchronization = nil
Going to close this issue as it's been a long time now