I’m working on setting up a two-part animation similar to this playground, where I have skeletal animation as well as rotational animation on a specific part of the model in Babylon. But, somewhere, I’m setting stuff up wrong.
My skeleton hierarchy (the image below) is probably different from the Dude’s,
but I don’t think that’s an issue since I was still able to locate the bone I want to rotate through scene.getBoneByName()
But when I try applying the logic below to the bones in my PG that are being logged, nothing seems to happen.
var scaleMatrix2 = BABYLON.Matrix.Compose(new BABYLON.Vector3(10,10,10), BABYLON.Quaternion.Identity(), BABYLON.Vector3.Zero());
console.log(skeleton.bones)
var initMat = skeleton.bones[0].getLocalMatrix().clone();
var m = skeleton.bones[0].getLocalMatrix();
m.multiplyToRef(scaleMatrix2, m);
animation.start(true);
var angle = 0;
scene.registerBeforeRender(function () {
var mat = skeleton.bones[0].getLocalMatrix().copyFrom(initMat);
mat.multiplyToRef(BABYLON.Matrix.RotationZ(angle), mat);
angle += 0.1;
skeleton.bones[0].markAsDirty();
})
I’ve tried, rotate, rotation, and setRotation as well in different formats (potentially all wrong as well) and haven’t had any success.
Any advice on this would be greatly appreciated.
Unfortunately I can’t provide a PG link (I’ve never saved one) due to the proprietary nature of the content I’m working with.