@prominent I think I found a different solution, attach the bone in question to the scene before rotating it to rotate it on the global access instead of local and then reattach the bone to its parent:
function boneLookAtLocal(bone, position) {
bone.updateMatrixWorld()
let direction = position.clone().normalize()
let pitch = Math.asin(-direction.y)// + bone.offset
let yaw = Math.atan2(direction.x, direction.z); //Beware cos(pitch)==0, catch this exception!
let roll = Math.PI;
bone.rotation.set(roll, yaw, pitch);
}
function boneLookAtWorld(bone, position) {
scene.attach(bone)
boneLookAtLocal(bone, position)
bone.parent.attach(bone)
}
boneLookAtWorld(hand.wrist, new THREE.Vector3(1, 1, 1))
boneLookAtWorld(hand.index[0], new THREE.Vector3(1, 1, 1))
boneLookAtWorld(hand.index[1], new THREE.Vector3(1, 0, 1))
boneLookAtWorld(hand.index[2], new THREE.Vector3(0, -1, 0))
yields:
which is how is exactly what I want! However, if we rotate the wrist right after those 4 calls in a different direction:
The wrist rotates without the rest of the finger. And if you noticed in the previous picture, the blue and green lines that make up the finger on the skeleton helper disappeared, so I’m thinking that when I call attach() it removes the bond from following the rotation of the parent.
Is there anyway to “re-astablish” that bond without resetting the fingers rotations? or anyway to capture the position it would be in and then move it there or?