How to manually add a skeleton in Qt3d?
In Qt, I added a Mesh using
QSceneLoader, but I wanted to rig the mesh manually in QT using the classes from Qt3D:
QJoint, QSkeleton, and QArmature. I have not seen a lot of documentation on creating a skeleton that's applied to a mesh through C++ alone.
Even without C++, I found you can give an armature value in QML, but the file needs to be a
.gltf. What I want to do is use C++ directly to make a skeleton so the programming-side has full control of the bone hierarchy.
QSkeleton gives one the abilitiy to add joints and child joints, but how are these joints then applied to the mesh? If there's any examples on this that would also be a great help.
Here's what I've tried:
Qt3DCore::QSkeleton* skeleton = new Qt3DCore::QSkeleton(); Qt3DCore::QJoint* joint = new Qt3DCore::QJoint(); joint->setTranslation(entityTransform->translation()); skeleton->setRootJoint(joint); Qt3DCore::QArmature* a = new Qt3DCore::QArmature(); a->setSkeleton(skeleton); entity->addComponent(a);
I also have an update function where I change the joint's translation/rotation and re-apply the skeleton to the armature, but it does nothing, so I don't know if the joint/armature has been applied properly to the mesh.