Default RealityViewContent has multiple anchors?

I am developing an app in mixed immersive native app on Vision Pro. In my RealityView, I add my scene by content.add(mainGameScene). Normally the anchored position (original coord) should be the device position but on the ground (with y == 0 on the ground). At least this is how I understand the RealityViewContent works. So if I place something at position (0, 0, -1.0), the object should be in the front of you but on the floor (z axis is pointing backwards)

However recently I load a different scene and I add that with same code, content.add(mainGameScene), something has changed, my scene randomly anchored on the floor or ceiling, according to the places I stand or sit. When I open Visualizations of my anchoring point, I could see that anchor point I am using is on the ceiling. The correct one (around my foots) is left over there.

How could I switch to the correct anchored position? Or does any setting can change the behavior of default RealityViewContent?

Accepted Reply

Turns out it's the matter of 3D model (or at least replacing with new 3D model can fix it). The original model contains a scope type (I don't know what does it mean in Reality Compose Pro). I use this model as .usdz and drag and drop to my scene. But it seems like this "scope" hierarchy has blocked the model to use its parent's anchor. Which I think with literal understanding, "scope" means it is not "controlled" by its parent?

Replies

However recently I load a different scene and I add that with same code, content.add(mainGameScene), something has changed, my scene randomly anchored on the floor or ceiling, according to the places I stand or sit.

It sounds like you are loading a scene that was created in Reality Composer Pro. You likely have an Anchoring component somewhere in your scene hierarchy that is set to anchor to any plane. I recommend searching through your scene in Reality Composer Pro and looking for an Anchoring component, and then removing it, since it sounds like the behavior you want is the default anchoring (equivalent to world anchoring at [0,0,0]).

  • Thanks! That really reminds me to checkout AnchorComponent. Probably I need to manually set AnchorComponent to the .world? Since my mainGameScene right now is just a default empty scene. I have checked my "Root" object and contains only default Transform and Material Bindings. But I do will attach AnchorComponent to my scene to see if that could override some default or unstable settings.

  • Also I wonder If I want to add an empty Entity as common parent to serve as the parent of all my different game scenes. Say I have different levels and when I switch from level 1 to level 2, I just need to write level1.removeFromParent() and myCommonParent.addChild(level2) to control over the level switch. Can I implement this by adding content.add(myCommonParent)? Seems like this can still lead to the anchor issue. But if myCommonParent = AnchorEntity(.world), would that be possible?

  • Hi @gchiste , I have check that out, my scene actually doesn't contain anything, just an empty scene and all the other game objects are placed and generated in runtime (by loading object from another .usda scene). I didn't find any AnchorComponent in any of my scene (.usda file). Is there any other way that may affect the anchored position?

@milanowth

If you don't have an Anchoring component, then most likely the offset from the world origin that you are seeing is baked into the geometry of the model you are adding to your scene.

  • But this won't change the fact that my anchoring under Visualization being randomly switched to ceiling/table/floor right? In the ARKit I only track handAnchor with HandTrackingProvider. I am thinking is it possible to use available anchors' transformation to transform my scene back to the correct position?

Add a Comment

Turns out it's the matter of 3D model (or at least replacing with new 3D model can fix it). The original model contains a scope type (I don't know what does it mean in Reality Compose Pro). I use this model as .usdz and drag and drop to my scene. But it seems like this "scope" hierarchy has blocked the model to use its parent's anchor. Which I think with literal understanding, "scope" means it is not "controlled" by its parent?