Changing the area of an object that transform.position refers to

I have a character object that is instantiated when a user starts the game and is put in a game room (Using Photon Networking Engine). I have a third person camera controller which follows, zooms, etc relevant to the camera position and the target position.

The script that controls this takes a collider as the target, this was built to be used with an object that has a capsule collider component. I have changed my object to use a compound collider with box colliders on every child, i.e. head, torso, forearm, etc. Initially I set the target collider to the collider component attached to the “Head” child, however this was problematic as whenever the head moved through animation, the camera would move with it. Now I have a small capsule collider attached to the main parent object of my character which is set as the target for the script, this collider is positioned inside the characters head.

The script finds the target by using target.transform.position, I would have expected this to get the position of the collider, does this get the position of the object the collider is attached too? The target position is currently appearing as the bottom of my character, that being the feet. How do I make it so that the script will orbit and zoom based on the position of the collider, that being the characters head.

Thanks in advance.

I’m assuming you have a larger character with a smaller collider offset to the head of the character. You can try using:

target.collider.bounds.center