Physics.Raycast hit distance <> vector distance

Hello,
have a question regarding Raycast hit distance.
I orignally had an issue and found another thread mentioning we should normalize the direction vector.

Without normalized direction I have values for hit.distance within the maxdistance value (for maxdistance 5, I had values like 4.7, 4.9, …)
With normalized direction I have values between 0 and 1.
It is strange for me that the direction has such an influence on the distance.

I suppose that if I multiply maxdistance by the normalized direction I will get the actual distance ?

Additionally, in both cases, the object distance (calculated with Vector3.Distance), give values such as 22.8, 23.7 …).
So object distance has nothing to do with hit.distance.

Why ?

            if (Physics.Raycast(transform.position, Vector3.Normalize(SeenObject.transform.position - transform.position), out hit, SightRadius, WhatToPursuit))
            {
                    Debug.Log("vector distance " + Vector3.Distance(transform.position, SeenObject.transform.position - transform.position));
                    Debug.Log("seenobject distance " + hit.distance);
            }

I’m not sure about the results you’re seeing with the direction (although I am sure it should be normalized like you just showed), but regarding the distance to the object:

You’re checking the distance to the origin of the objects (usually the center).
The raycast however will return the distance from the original point to the hit point. That is, the point of contact between the ray and the collision object.

So it could make sense if your target object has a collision shape with distance from it’s origin to the edge of it of about 18.

Thanks for the answer.

Well, well, well,
that was totally stupid.

I was actually using a direction vector instead of the position:

 Vector3.Distance(transform.position, SeenObject.transform.position - transform.position)

Vector3.Distance(transform.position, SeenObject.transform.position)

The copy/paste devil striked.

Still your answer helped as I did not think of the difference between “hit point” and the pivot.