Qt6 topics merged with General

Qt3D 2.0 change object pivot

  • Hey there community,

    currently I am trying to make a scene where I import an car object into my scene and where i can oben doors etc.

    So i stripped my model into a few models.. like doors, wheels and so on

    Now that i have imported these models into my scene I want to animate them. And here starts the problem.

    For example: I have set in Blender the pivot/origin of a door so that i can rotate it and get an opening effect. But the pivot point is not exported into the .obj file, but reset to (0, 0, 0).
    When I export my model as .fbx file, the origin is exported fine.

    Is there any possiblity to set the pivot point of a mesh in qml/qt3d or is there a module for importing fbx files? As far as I know Qt3D 2.0 only supports .obj files.
    In Qt3D 1.0 there was support for more formats than just .obj.

    I am using Qt 5.5

    Kind regards,


  • nobody? i could really need some help

  • Hi cRooked

    usually applying a rotation matrix rotates somewhat around the origin / or an axis that goes through the origin.

    So a workaround might be to translate the part to the origin, rotate it, and translate it back. (you still need to know the coordinates of the pivot though):

    Qt3D::QTranslateTransform *TranslateToOrigin = new Qt3D::QTranslateTransform();
    TranslateToOrigin->setTranslation(QVector3D(-x_pos, -y_pos, -z_pos));
    Qt3D::QRotateTransform *doorRotation = new Qt3D::QRotateTransform();
    doorRotation->setAxis( door_hinge_axis ); // axis as a QVector3D..
    Qt3D::QTranslateTransform *TranslateBack = new Qt3D::QTranslateTransform();
    TranslateBack->setTranslation(QVector3D(x_pos, y_pos, z_pos));
    // ... some code
    Qt3D::QTransform *doorGeoTransforms = new Qt3D::QTransform();

    i'm sure this workaround could be optimized a bit, using just negative translate as translateBack or the like ...

    hope this helps.

Log in to reply