I'm looking through the ARKitInteraction sample app, and there are a few things I don't really understand about how the trackedRaycast transform and the ARAnchor transform area related.
1. In the trackedRaycast handler, the result of the raycast is assigned to the SCNNode's transform. However, that object is already attached to an ARAnchor, and in the documentation, it says "Adding an anchor to the session helps ARKit to optimize world-tracking accuracy in the area around that anchor, so that virtual objects appear to stay in place relative to the real world. If a virtual object moves, remove the corresponding anchor from the old position and add one at the new position."
Doesn't this mean the Anchor and the trackedRaycast are giving conflicting instructions?
2. In the ARSCNViewDelegate's
func renderer(_ renderer: SCNSceneRenderer, didUpdate node: SCNNode, for anchor: ARAnchor)
implementation, there's the call
objectAtAnchor.simdPosition = anchor.transform.translation
Doesn't the fact that didUpdate is being called mean that the anchor transform was already set to the object transform? I'm guessing this is to help the trackedRaycast functionality work with the anchor functionality, but I don't see how.