Unable to rotate RealityView model via DragGesture

I am trying to implement a way to rotate a 3D model around its y axis, but this doesn't seem to work. What am I missing?

The scene only contains one model entity.

@State private var rotateBy:Double = 0.0

RealityView { content in
                    do {
                        let entity = try await Entity.init(named: "VinylScene", in: realityKitContentBundle)
                        entity.scale = SIMD3<Float>(repeating: 0.6)
                        content.add(entity)
                    } catch {
                        ProgressView()
                    }
                }
                .gesture(
                    DragGesture(minimumDistance: 0.0)
                        .targetedToAnyEntity()
                        .onChanged { value in
                            let location3d = value.convert(value.location3D, from: .local, to: .scene)
                            let startLocation = value.convert(value.startLocation3D, from: .local, to: .scene)
                            
                            let delta = location3d - startLocation
                            
                            rotateBy = Double(atan(delta.x * 200))
                        }
                )

Did you add collision support in Reality Composer Pro?

Otherwise I'd add:

                entity.generateCollisionShapes(recursive: false)
                entity.components.set(InputTargetComponent())

...before adding it to your content.

Still no luck. For reference, this is my code so far:

import SwiftUI
import RealityKit
import RealityKitContent
import UIKit

struct RecordView: View {
    @State private var rotateBy:Double = 0.0
    
    let record: Record
    
    var body: some View {
        
        RealityView { content in
            do {
                let entity = try await Entity.init(named: "CDScene", in: realityKitContentBundle)
                entity.generateCollisionShapes(recursive: false)
                entity.components.set(InputTargetComponent())
                entity.scale = SIMD3<Float>(repeating: 0.6)
                content.add(entity)
            } catch {
                ProgressView()
            }
        }
        .gesture(
            DragGesture(minimumDistance: 0.0)
                .targetedToAnyEntity()
                .onChanged { value in
                    let location3d = value.convert(value.location3D, from: .local, to: .scene)
                    let startLocation = value.convert(value.startLocation3D, from: .local, to: .scene)
                    
                    let delta = location3d - startLocation
                    
                    rotateBy = Double(atan(delta.x * 200))
                }
        )
    }
}

I have also tried to add collision support manually to the root of the scene in Reality Composer Pro, still nothing. For information, the scene only consists of a simple USDZ model that i have exported through Adobe Subtance Painter.

Seems like a lot of people has issues with the gestures, so my buddy and i made a library, hope it helps 🙏 https://github.com/Umain-Vision-Pro/UmainSpatialGestures

Unable to rotate RealityView model via DragGesture
 
 
Q