2

I'm trying to make a simple collaborative app with RealityKit and the MultipeerConnectivity framework where all users can interact with the same entity. I have a simple RealityComposer .reality file with a cube that jumps up every time the user taps on it.

Setting up the multipeer connection and loading the Entity from the .reality file works fine so far.

But I really don't understand how to manage that only one cube is in the scene for every user in the session.

What I tried:

  • adding Tap Gesture to arView which creates an ARKit's ARAnchor (which is synced to all peers). After adding the anchor I disable the gesture recognizer.

  • in the didUpdateAnchor delegate function I am looking for this anchor (this is called on all peers as soon the anchor is synced), creating an AnchorEntity for this anchor, adding it to the scene, loading the Entity from the reality file and adding it as child of the EntityAnchor. If I do this every peer seems to create a cube and I see two or more cubes in the scene.

How can I load the models (like meshes, sound, etc) on every peer for a synced ARAnchor and tell ARKit/RealityKit that this one and the same virtual object?

Andy Jazz
  • 49,178
  • 17
  • 136
  • 220
iMax
  • 31
  • 1
  • Hello! Did you somehow solve problem of 'double adding' the model for multipeer session in ```session (_ session :, didAdd anchors:)``` or ```session (_ session :, didRemove anchors:)```? I have the same problem, I can’t figure out how to solve it. [https://stackoverflow.com/questions/61839870/realitykit-multipeer-session-object-sync-issue] – Vegi Woo May 19 '20 at 15:25

0 Answers0