Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problems with rotating object about its own axis in Qt3D (QML)
Qt 6.11 is out! See what's new in the release blog

Problems with rotating object about its own axis in Qt3D (QML)

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 612 Views 1 Watching
  • 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.
  • J Offline
    J Offline
    James321
    wrote on last edited by kshegunov
    #1

    I have imported several .obj files from blender into QML. I need to scale certain objects and rotate them about their own axis (not an axis about the origin).

    I can easily scale and rotate about the origin as follows:

    Transform {
            id: rotationTransform
            property real userAngle: 0.0
            scale3D: Qt.vector3d(200, 200, 200)
            rotation: fromEulerAngles(0,0,userAngle)
            // or rotationX: userAngle         
        }
    

    Scaling and rotating about the object's own axis is something I cant seem to do

    I have tried the following:

        Transform {
            id: rotationTransform
            property real rotationAngle: 0.0
            matrix: {
                var r = rotateAround(Qt.vector3d(1, 1, 1), rotationAngle, Qt.vector3d(1, 1, 1));
                var s = Qt.matrix4x4();
                s.scale(200);
                return r * s;
            }
        }
    
        Transform {
            id: rotationTransform
            property real userAngle: 0.0
            scale3D: Qt.vector3d(200, 200, 200)
           matrix: rotateAround(Qt.vector3d(200, 200, 200), userAngle, Qt.vector3d(0, 0, 1))
        }
    
        Rotation{
            id: rotationTransform
            property real rotationAngle: 0.0
            axis: Qt.vector3d(0, 0, 1)
            origin: Qt.vector3d(1, 1, 1)
            angle: rotationAngle
        }
    
                    Transform {
                        id: rotationTransform
                        property real userAngle: 0.0
                        matrix: {
                            var m = Qt.matrix4x4();
                            m.translate(Qt.vector3d(8.06, -18.04, 14.28));
                            m.rotate(userAngle, Qt.vector3d(0, 0, 1))
                            m.translate(Qt.vector3d(-8.06, 18.04, -14.28));
                            return m;
                        }
                        scale3D: Qt.vector3d(200, 200, 200)
                    }
    

    [Locked as duplicate of https://forum.qt.io/topic/81457/problem-with-qt3d-rotation-about-axis-of-object ~kshegunov]

    1 Reply Last reply
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved