How does WorldToViewportPoint tells us the center of the object

Vector3 viewPos = cam.WorldToViewportPoint(checkedObject.position);
if (viewPos.x >= 0 && viewPos.x <= 1 && viewPos.y >= 0 && viewPos.y <= 1 && viewPos.z > 0)
{ //Code after you get the center}

I verified that utilising the aforementioned condition (as mentioned here), you will always receive the object’s centre as observed by the camera. I was curious as to how it always provided the object’s centre. For the same, I read the Unity Docs too, but I was unable to find anything there either.

, Vector3 viewPos = cam.WorldToViewportPoint(checkedObject.position);
(viewPos.x >= 0 && viewPos.x <= 1 && viewPos.y >= 0 && viewPos.y <= 1 && viewPos.z > 0)
I verified that using the aforementioned condition (as mentioned here), you will always receive the object’s centre as observed by the camera. I was curious as to how it always provided the object’s centre. For the same, I read the Unity Docs too, but I was unable to find anything there either.

you will always receive the object’s centre as observed by the camera

No, that’s not true. You pass in the object’s pivot point and have it being projected into viewport coordinates. If the pivot of an object is not the center of the object, you would not get the center of the object. So I’m not really sure what you’re actually asking. checkedObject.position is just a point you pass to the WorldToViewportPoint method which converts a point from one coordinate space (world space) to another (viewport space). Where that point is relative to the object completely depends on the object.

Just for example a default Unity cube object has its pivot in the center of the cube. So I’m really not sure what you’re asking here.

Oh okay, Thank you @Bunny83. I got the logic and my answer. I was always passing the center of the object to cam.WorldToViewportPoint() as parameter, that is why it was taking center of the object as origin.