Hello all, RealityKit. visionOS.
I have a parent entity (surface in the code below) that I'm adding him a child entity with all the required components for gestures (collision & input target). I'm setting the TapGesture as expected (same for SpatialTapGesture).
Result: gesture is not working. Neither the hover effect. The entity is not recognized as a tappable element.
However, if I'm adding the child entity to the content and not to the parent entity - everything is working. Enclosed code below for both scenarios.
Any idea?
Many thanks, Dudi
Doesn't work -
RealityView { content, attachments in
let scene = clonedEntity.clone(recursive: true)
...
surface.addChild(scene) // <- Doesn't work
} attachments: {
...
}
.gesture(SpatialTapGesture().targetedToAnyEntity().onEnded { value in
openWindow(id: "detailed-window")
})
.hoverEffect()
Work -
RealityView { content, attachments in
let scene = clonedEntity.clone(recursive: true)
...
content.add(scene) // <- Work
} attachments: {
...
}
.gesture(SpatialTapGesture().targetedToAnyEntity().onEnded { value in
openWindow(id: "detailed-window")
})
.hoverEffect()