Hi, I looked Diorama example, and I wanted to do the same.
Which is to have custom PointOfInterestComponent in the anchor object in Composer Pro.
In the Scene, I iterates to find that tag with attachment( which I created when adding that scene), and each the attachment
update: { content, attachments in
viewModel.rootEntity?.scene?.performQuery(Self.runtimeQuery).forEach { entity in
guard let attachmentEntity = attachments.entity(for: component.attachmentTag) else { return }
guard let component = entity.components[PointOfInterestRuntimeComponent.self] else { return }
guard let attachmentEntity = attachments.entity(for: component.attachmentTag) else { return }
guard attachmentEntity.parent == nil else { return }
attachmentEntity.setPosition([0.0, 0.4, 0], relativeTo: entity)
entity.addChild(attachmentEntity, preservingWorldTransform: true)
}
This doesn't show attachment Entity, but if I do
content.addChild( attachmentEntity )
instead of entity.addChild, it shows up.
What could be wrong?
Post
Replies
Boosts
Views
Activity
in Diorama project,
let entity = try await Entity(named: "DioramaAssembled", in: RealityKitContent.RealityKitContentBundle)
viewModel.rootEntity = entity
content.add(entity)
viewModel.updateScale()
// Offset the scene so it doesn't appear underneath the user or conflict with the main window.
entity.position = SIMD3<Float>(0, 0, -2)
Object doesn't move around with Camera - with the simulator workthrough wasd key
I can work around the object.
But with different composer file, that I created
let entity = try await Entity(named: "ImmersiveScene", in: realityKitContentBundle) {
viewModel.rootEntity = entity
content.add(entity)
viewModel.updateScale()
with wasd key in the simulator, model moves with it.
What confirugation that I'm missing with ImmersiveScene Entity?
Can you use View with Transferable View in the one WindowGroup to another
ImmersiveSpace with RealityView?
I can drag, but the drop event isn't captured when with RealityView
var body: some View {
let droppable = Droppable( model: model )
RealityView { content in
// Add the initial RealityKit content
content.add(floorEntity)
}
.onDrop( of: ...
// or
.dropDestination( For ... {}
//or
.gesture( DragGesture()
.targetedToAnyEntity()
.onChanged({ value in
none of them triggers the drop