Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. Problem with Qt3D rotation about axis of object
Forum Updated to NodeBB v4.3 + New Features

Problem with Qt3D rotation about axis of object

Scheduled Pinned Locked Moved Unsolved Game Development
1 Posts 1 Posters 235 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 18 Jul 2017, 18:36 last edited by
    #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)
                    }
    
    1 Reply Last reply
    0

    1/1

    18 Jul 2017, 18:36

    • Login

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