Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Unsolved Animate a mesh rotation around a specific axis

    General and Desktop
    qt3d 2.0 animation qml c++
    1
    1
    409
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      elsa last edited by

      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!

      1 Reply Last reply Reply Quote 0
      • First post
        Last post