Hi I have setup some attachments in SwiftUI code using a custom component added to transforms entities in RealityComposer Pro. This attachment have a button too. Everything works fine. Since I need a billboard effect for my attachments, I added
guard let component = entity.components[PointsOfInterestRunTimeComponent.self] else {return}
guard let attachmentEntity = attachments.entity(for: component.attachmentTag) else { return }
guard attachmentEntity.parent == nil else {return}
var billBoard = BillboardComponent()
billBoard.rotationAxis = [0,1,0]
attachmentEntity.components.set(billBoard)
content.add(attachmentEntity)
attachmentEntity.setPosition([0.0, 0.5, 0.0], relativeTo: entity)
And this is my attachment view.
VStack(alignment: .leading, spacing: 10) {
Text(name)
.matchedGeometryEffect(id: "Name", in: animation)
.font(titleFont)
Text(description)
.font(descriptionFont)
Button("Done") {
viewModel.arrows.remove(at: 0)
}
}
My problem is after adding billboard component, sometimes button inside my view is not clickable. It works only in the initial position of the player. how can I resolve this?