Camera attached to the bone can only see its own mesh

Hi everyone!

OLD TITLE OF THIS POST: How to add a camera to the head bone in a glb skeleton?

As the title says I am trying to add a camera to the head bone.

When I add the camera to the bone of an FBX skeleton it works perfectly, but when I do the same in a GLB skeleton it doesn’t work.

It seems as if the camera was not in the scene.

First look at the FBX example, you can click on the buttons to switch between the cameras, it works as expected

FBX Example

Now look at the GLB example

GLB Example

Please note that when the “Camera 2” button is clicked nothing appears on the camera.

Any suggestion?

I know there is another way to do it by copying the positions and rotations like this:

let headBone = model.children[0].children[1].skeleton.bones[5];

const position = new THREE.Vector3();
headBone.getWorldPosition(position);

const quaternion = new THREE.Quaternion();
headBone.getWorldQuaternion(quaternion);

cameraPOV.position.copy(position);
cameraPOV.quaternion.copy(quaternion);

//cameraPOV.rotation.y = cameraPOV.rotation.y + THREE.MathUtils.degToRad(180);

cameraPOV.updateMatrixWorld(true);
cameraPOVHlper.update();

But this time I want to add the camera directly to the bone.-

EDIT: I discovered that the camera attached to the bone can only see its own mesh, why does this happen?

/cc

Hi @Mugen87, yes i put the question in stackoverflow too. I violate any rules of this site? If yes sorry.
Any suggestions on how to watch the scene from the camera in the head?

SOLVED! Instead of adding the camera to the head bone add the camera to the head mesh!

No, everything’s fine. Just share a link to your questions if you ask them elsewhere. In this way, it’s easier to find out if there is already an answer which saves redundant work.

Good!

I finally found how to add the camera to the head, in mixamo models this is the “address” of the head mesh:

headMesh = model.children[0].children[1].skeleton.bones[5].children[3];
headMesh.add(cameraPOV);