I keep running into stupid problems. This time I can’t seem to rotate a bone in world space.
So what am I missing?
// Works, but in local space.
hips.rotation = new BABYLON.Vector3(0, Math.PI, 0);
// Does not seem to do anything.
hips.rotation.set(0, Math.PI/2, 0);
// Does not seem to do anything.
hips.setRotationQuaternion(BABYLON.Quaternion.FromEulerAngles(0, Math.PI, 0), BABYLON.Space.WORLD, legUpper);
// Does not seem to do anything.
hips.setRotation(new BABYLON.Vector3(0, Math.PI, 0), BABYLON.Space.WORLD, legUpper);
I agree, will that not effect skeletons that have animations? I think now that we have the correct matrices being stored we don’t have to return things to rest anymore when building the viewer do we?
UPDATE
I am pushing updates to this today, so I will make the change because after testing it looks like we do not need it anymore.
If someone does then they can flick it on!
Glad we can come to some discussion on this prior to me writing the documents because I know now what to include.
Please forgive my ignorance but even if I don’t create a SkeletonViewer the rotation seem to be local even though I specify Space.WORLD. I’m trying to rotate around the world Y axis so that the leg aligns with the full body skeleton.
However, the rotation still seems local to me. And changing it to Space.LOCAL does in fact show the same rotation. Also I’m a bit puzzled by the mesh argument. Why it’s needed, why you commented it out, and if not including it means it will make a local rotation?
When passing a mesh in parameter, its world matrix is taken into account to compute the world matrix of the bone (this parameter is not used when using local space).
But it seems that when using WORLD space everything cancels out at some point and you end up having the same result than for LOCAL space…
I fear my knowledge of how the code works/should work is not deep enough, maybe @Drigax will know more about this (he’s coming back next monday, so be patient).