So guys @Deltakosh , @sebavan , @Evgeni_Popov and @bghgary
I made a class called GltfBoneIkController to try and figure out what needs to be done to support GLTF meshes where the bone has a bone._linkedTransformNode.
Here is a playground were i am loading a GLB (Big file 20MB… so please wait for it to load)
https://playground.babylonjs.com/#D0T14K?UnityToolkit
Pease look at lines 449, 456 and 466 … These are the lines that move the bone after all the calculations. Except we need to move the bone._linkedTransformNode instead of the actual bone.
Note: the bone update will move the actual bone fro the linkedTransformNode at a different spot in the codebase
basically how do i the equivalent calls for:
this._bone1.setRotationQuaternion
and
this._bone1.setRotationMatrix
and
this._bone2.setAxisAngle
but for the linked transform node
i outlined like this. Lines 440 thru 470
if (this._bone1) {
if (this.slerpAmount < 1) {
if (!this._slerping) {
BABYLON.Quaternion.FromRotationMatrixToRef(this._bone1Mat, this._bone1Quat);
}
BABYLON.Quaternion.FromRotationMatrixToRef(mat1, _tmpQuat);
BABYLON.Quaternion.SlerpToRef(this._bone1Quat, _tmpQuat, this.slerpAmount, this._bone1Quat);
angC = this._bone2Ang * (1.0 - this.slerpAmount) + angC * this.slerpAmount;
if (this._bone1._linkedTransformNode != null) {
// TODO: PORT TO TRANSFORM NODE - this._bone1._linkedTransformNode.setRotationQuaternion(this._bone1Quat, BABYLON.Space.WORLD, this.mesh);
} else {
this._bone1.setRotationQuaternion(this._bone1Quat, BABYLON.Space.WORLD, this.mesh);
}
this._slerping = true;
} else {
if (this._bone1._linkedTransformNode != null) {
// TODO: PORT TO TRANSFORM NODE - this._bone1._linkedTransformNode.setRotationMatrix(mat1, BABYLON.Space.WORLD, this.mesh);
} else {
this._bone1.setRotationMatrix(mat1, BABYLON.Space.WORLD, this.mesh);
}
this._bone1Mat.copyFrom(mat1);
this._slerping = false;
}
}
if (this._bone2._linkedTransformNode) {
// TODO: PORT TO TRANSFORM NODE - this._bone2._linkedTransformNode.setAxisAngle(this._bendAxis, angC, BABYLON.Space.LOCAL);
} else {
this._bone2.setAxisAngle(this._bendAxis, angC, BABYLON.Space.LOCAL);
}
this._bone2Ang = angC;
Can you guys take a look and apply your 2 cents on how we should tackle this … Please