The next code strikes an entity all through the house when tapped. That works effective however how would I get an occasion notification (I think about a AnimationEvents.PlaybackCompleted)for when the animation finishes?
struct ImmersiveGameView: View {
let entity = Utils.generateBall(colour: .inexperienced) //Generates a Entity sphere
let viewModel = ImmersiveGameViewModel()
var physique: some View {
RealityView { content material in
entity.setPosition(SIMD3(0, 1, -0.7), relativeTo: nil)
content material.add(entity)
}
.gesture(SpatialTapGesture().targetedToAnyEntity().onEnded({ worth in
var rework = Rework()
rework.translation.z = entity.place.z - 10
rework.translation.x = entity.place.x
rework.translation.y = entity.place.y
worth.entity.transfer(to: rework, relativeTo: nil, period: 2)
}))
}
}