My Solution
You can get the location of the tap gesture on an entity with:
let worldPosition: SIMD3<Float> = value.convert(value.location3D, from: .local, to: .scene)
You can grab he orientation of the tapped plane with
let rotation = value.entity.orientation(relativeTo: nil)
I want to track this location so it can be persisted in the WorldTrackingProvider (whenever it works??? ) with a world anchor. I do so by making a world anchor with:
let pose = Pose3D(position: worldPosition, rotation: rotation)
let worldAnchor = WorldAnchor(originFromAnchorTransform: simd_float4x4(pose))
When you get the anchor from your world tracking listener you can apply it's transform (which contains position and orientation) to an entity like so:
entityForAnchor.transform = Transform(matrix: anchor.originFromAnchorTransform)
If you've got another way, or a way that has a more intuitive use of the API topology please share. This was cobbled together with a ton of trial and error.
Topic:
Graphics & Games
SubTopic:
RealityKit
Tags: