In VisionOS there is a Rotate3DGesture that can be used to rotate models in 3D space:
RealityView { content in
if let scene = try? await Entity(named: "Scene", in: realityKitContentBundle) {
entity = scene
content.add(scene)
}
}
.gesture(TapGesture().targetedToAnyEntity().onEnded{ value in
print("rotation: ", value.entity.transform.rotation)
print("orientation: ", value.entity.orientation)
})
.gesture(RotateGesture3D(minimumAngleDelta: .degrees(10)).targetedToAnyEntity().onChanged{ value in
value.entity.orientation = value.convert(value.rotation, from: .local, to: entity)
})
Read this answer for instructions on how to implement rotation using a DragGesture.