Problems with rotating object about its own axis in Qt3D (QML)
Locked
Unsolved
General and Desktop
-
wrote on 18 Jul 2017, 18:46 last edited by kshegunov
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/1