Animate a mesh rotation around a specific axis



  • Hi everyone,
    I have a car and a car door that I want to animate to open. One task is to rotate the door around a specific axis, not the origin of the scene, which I already managed to do (see also this thread).
    Now I want to animate this rotation. I can easily use QPropertyAnimation to rotate the door around the origin, but how can I make the animation rotate around the axis I choose? Is there a built in rotation property with a rotation axis that I don't know of? Or do I have to define my own property? (If yes, how?) Or do I have to use another animation class?
    As far as I know, in QML you can do something like this:

    Rotation3D{
      id: doorRotation
      angle: 0
      axis: Qt.vector3d(0,1,0)
      origin: Qt.vector3d(-1.023, 0.836, -0.651)
    }
    
    NumberAnimation {target: doorRotation; property: "angle"; from: 0; to: -20; duration: 500}
    

    where you can define this Rotation3D object. Is there an equivalent to it in C++?

    Thanks!



Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.