Hello Apple People,
Have a really basic question about the API of RealityKit.
Question:
Am I correct in that Realitykit has two ways to add an AnchorEntity to the scene.AnchorCollection?
First way would be:
Summary
Adds an anchor to the scene’s list of anchors.
Declaration
func addAnchor(_ anchor: HasAnchoring)
Second way would be:
Summary
No overview available.
Declaration
func append(_ entity: Scene.AnchorCollection.Element)
Observation:
If you "dig into the weeds of the Realitykit " API you will see this:
typealias Scene.AnchorCollection.Element = HasAnchoring
I believe one could think of the RealityKit code this way:
func append(_ entity: HasAnchoring)
I know this is a basic question, but Any Apple Devloper or kind soul intrested in helping a fellow Apple coder would be much apprecated.
We all learn by sharing what we know
Smartdog
Hi,
Yes, using scene.anchors.append(myAnchor) has the same effect, and has the added bonus of being able to add multiple independent anchors at the same time by using scene.anchors.append(contentsOf: [Scene.AnchorCollection.Element]).
I don't know of any reason this should or should not need to be utilised. Only that to me, scene.addAnchor() seems like a nicer looking way to achieve the same thing, thus may be what the RealityKit team is expecting us to use.