Trying to find some answers on why billboarding isn't working when attaching to an entity that is a child of an anchor.
I'm trying to billboard an attachment so that it remains pointed at the user wherever they're viewing the content from. For example, showing some context information over dynamic 3d model on the table top. Not baked into a Reality Composer pro scene. I pulled the component and system used in the various Apple example projects (Diorama) that have the billboarding system.
Playing around with the system and component I can add a simple model entity to the scene, tag it with the component and it works perfectly, all the time. As the camera moves it tracks it perfectly. Even when nested under other empty entities or off center or oddly rotated.
Great! Then I wanted to apply this to an attachment that is shown from a model entity that is anchored to a horizontal plane and all of the sudden it doesn't work at all.
I create the anchor:
let anchor = AnchorEntity(.plane(.horizontal, classification: .table, minimumBounds: [0.01, 0.01]))
if let lookAtText = attachments.entity(for: "LookAtMe") {
lookAtText.position = [0,0.5,0]
lookAtText.components.set(BillboardComponent())
lookAtText.name = "Look At Me"
anchor.addChild(lookAtText)
}
content.add(anchor)
The attachment shows correctly above the anchor, as expected, and does rotate some, just totally wrong or stops, It does not billboard correctly, or even remotely correctly.
if I switch the anchor.addChild
to be a content.add
it isn't in the correct place, but billboarding works.
I don't understand why adding it as a child to the anchor entity suddenly breaks completely unrelated systems.
Am I doing something wrong or is this some sort of privacy issue? I can't find any documentation that using the look at api from an anchored entity is somehow forbidden.