Position issue Collaborative session with Reality Composer entity

Hello,
I have a working collaborative session using multipeer connectivity. I am able to sync entity that I create programmatically between 2 phones.
However when I try to sync Reality Composer entity/scene, it does not work properly. I can see the entity synced between the 2 phones but the anchored position is completely different.
Any idea?
Thanks in advance.

Replies

HI Ar123,

We'd love to see your source code - if you've filed a Feedback Item (http://feedbackassistant.apple.com) please post the FB number here! Thank you!
When loading your model from a Reality file using Entity.loadAnchor or via the auto-generated code (which uses loadAnchor) the anchor you specified in Reality Composer is retained.

What this means is when you add the model to your scene you have a graph that looks a little like this:

Scene
|
AnchorEntity (that you created)
|
AnchorEntity (from Reality Composer)
|
ModelEntity

The "most specific" AnchorEntity wins, I.e. the one specified in Reality Composer and not the one you created in code.

Instead of using Entity.loadAnchor or using the autogenerated code you can manually load your model via Entity.load() this will remove the AnchorEntity and your graph will look like:

Scene
|
AnchorEntity (that you created)
|
ModelEntity

This was very helpful but I have a follow up question. My Reality Composer scene has a behavior with a Notify Action.

If I use Entity.load() instead of the autogenerated code, can I still use behaviors with say a proximity trigger and a notify activity?

Thanks
I figured out a way to load reality composer scenes and fix the scene's entity world positions and preserve the ability to use the behaviors defined in the reality composer scene.

After loading the scene using the auto-generated code, I'm adding a new AnchorEntity with the correct world position. I then find the entity of interest in the reality composer scene and change it's parent to the newly added AnchorEntity.

So it's like this

Load Reality Composer scene with auto-generated code
Add new AnchorEntity with the world position set
Find the existing Reality Composer entity that I want to reposition and set it's anchor to the newly added AnchorEntity.


Hope this helps someone :)