Comments (5)
Glad I could help! I'm going to go ahead and close this issue now.
from multipeerhelper.
Hi!
The error message you’re seeing is not directly causing issues - that message appears for me whenever I do a hitTest/raycast etc since 13.4. I think it’s an internal RealityKit message which has something to do with how they compute raycasts.
Had a quick look through, and you shouldn’t need the DidOutputCollaborationData callback, realitykit should be doing that work for you since you set the sync service here
https://github.com/chenzhutian/collaboration-interaction/blob/1813f28c101f731f4419e88fed7042148d473cb5/CollaborativeSession/ViewController.swift#L67
See the example in this repo that it isn’t called or mentioned anywhere, and the entities sync regardless.
If you add the AnchorEntity, model etc. on just one device, but still run installGestures on both once the entity has synced then that’s most of the work. The last part is transferring the ownership before actually moving the box. This could be done by catching the touchesBegan event for your ViewController, seeing if that hits your box; if it does, then request ownership and start moving it. Or by getting the response from installGestures and add a delegate to the EntityGestureRecognizers.
I’d recommend making your own gesture instead of using installGestures too, but that may be unnecessary for your purposes.
from multipeerhelper.
Thank you for you reply. I have removed the DidOutputCollaborationData now.
I used to think that the problem may be due to the ownership problem. But the cube even cannot be moved by the user who adds it.
Say, here is what I have:
- Pair A and B
- A adds a cube. B can see it
- A tries to move the cube. But the cube cannot be moved.
from multipeerhelper.
I just cloned and tried it out:
You need to remove this:
https://github.com/chenzhutian/collaboration-interaction/blob/1813f28c101f731f4419e88fed7042148d473cb5/CollaborativeSession/ViewController.swift#L110
This will tell each device to add their own cube entity, I don't think that's what you want. When the entity is moved with the EntityGestureRecognizer it moves the entity, so if each device makes their own then that won't work.
Move the code to add the Anchor + ModelEntity inside the handleTap.
After that there are a few things you could do, the simplest would probably be to have a subscriber of SceneEvents.AnchoredStateChanged
running from the start and when that sees your AnchorEntity get added to the scene it installs the gestures to your ModelEntity (give it a name to check it's the one you want, just like you're currently doing on line 110). This is instead of the didAdd anchors: [ARAnchor]
check.
After that you'll have to be able to transfer the ownership if you want user B to influence the movement on A.
from multipeerhelper.
Hi~ Thank you for your comprehensive explanation. I find out a solution:
https://github.com/chenzhutian/collaboration-interaction/blob/master/CollaborativeSession/ViewController.swift#L118
that I only add the cube for a ARAnchor that comes from the user himself.
I think it is somehow tricky, the didAdd anchors: [ARAnchor]
will be invoked for all ARAnchors no matter where it comes from user A or user B. But the model attached to the anchors from user B do not need you to add again.
Next I will try to handle the ownership stuff.
Thank you again!
from multipeerhelper.
Related Issues (8)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from multipeerhelper.