How can we move the player within a RealityKit/RealityView scene?

How can we move the player within a RealityKit/RealityView scene? I am not looking for any animation or gradual movement, just instantaneous position changes.

I am unsure of how to access the player (the person wearing the headset) and it's transform within the context of a RealityView.

The goal is to allow the player to enter a full space in immersive mode and explore a space with various objects. They should be able to select an object and move closer to it.

I haven't found a way to gain access to the camera or player entity from the context of RealityView. In the meantime, I put together a quick demo that moves content in a USDA scene to the player. Move the world instead of the player.

struct Lab5017: View {
    @State var selected: String = "Tap Something"
    @State var sceneContent: Entity?
    @State var sceneContentPosition: SIMD3<Float> = [0,0,0]

    var tap: some Gesture {
        SpatialTapGesture()
            .targetedToAnyEntity()
            .onEnded { value in
                selected = value.entity.name

                // Calculate the vector from the origin to the tapped position
                let vectorToTap = value.entity.position

                // Normalize the vector to get a direction from the origin to the tapped position
                let direction = normalize(vectorToTap)

                // Calculate the distance (or magnitude) between the origin and the tapped position
                let distance = length(vectorToTap)

                // Calculate the new position by inverting the direction multiplied by the distance
                let newPosition = -direction * distance

                // Update sceneOffset's X and Z components, leave Y as it is
                sceneContentPosition.x = newPosition.x
                sceneContentPosition.z = newPosition.z

            }
    }

    var body: some View {
        RealityView { content, attachments in

            if let model = try? await Entity(named: "5017Move", in: realityKitContentBundle) {
                content.add(model)

                // Get the scene content and stash it in state
                if let floorParent = model.findEntity(named: "SceneContent") {
                    sceneContent = floorParent
                    sceneContentPosition = floorParent.position
                }

            }
            //Position the attachment somewhere we can see it
            if let attachmentEntity = attachments.entity(for: "SelectedLabel") {
                attachmentEntity.position = [0.8, 1.5, -2]
                attachmentEntity.scale = [5,5,5]
                content.add(attachmentEntity)
            }

        } update: { content, attachments in

            // Update the position of scene content anytime we get a new position
            sceneContent?.position = sceneContentPosition


        } attachments: {
            Attachment(id: "SelectedLabel") {
                Text(selected)
                    .font(.largeTitle)
                    .padding(18)
                    .background(.black)
                    .cornerRadius(12)
            }
        }
        .gesture(tap) // The floor child entities can receive input, so this gesture will fire when we tap them
    }
}

I'm just starting visionOS app development (actually something like room tour in immersive space) and have the same problem right now. So if I'm not mistaken "5017Move" is your USDA scene and "SceneContent" is USDZ model inside this scene, right? Tried several times and also added InputTarget and Collision components, but nothing works. Did you add any additional components in Reality Composer Pro or I misunderstood your code? Thanks in advance

How can we move the player within a RealityKit/RealityView scene?
 
 
Q