I can't seem to get the rotation gesture to work. Here is my code:
struct ContentView: View {
@State var rotation:Rotation3D = Rotation3D()
var rotate:some Gesture {
RotateGesture3D()
.targetedToAnyEntity()
.onChanged { gesture in
rotation = gesture.rotation
}
}
var body: some View {
RealityView { content in
let box = ModelEntity(mesh: .generateBox(size: 0.25))
box.generateCollisionShapes(recursive: false)
box.components.set(InputTargetComponent())
content.add(box)
}
.gesture(rotate)
.rotation3DEffect(rotation)
}
}
I assume it is up to me to apply the rotation with rotation3DEffect
but I have also tried it without. Is it just not supported in the simulator? Can I expect it to work on the device? If so, is the code correct?