Unity raycast

RaycastHit hit;
Ray ray = new Ray(character.cam.transform.position, character.cam.lookDir);
if(Physics.Raycast(ray, out hit)){
Debug.Log(hit.transform.position);
}

this returns (0, -1.5, 0) no matter where i am

Is there a collider on your character itself, perchance? And is the ray from character.cam always hitting that? You should Debug.Log the name of the hit collider to test and, if that’s the case, pass a layermask to your RayCast to avoid hitting that collider: Unity - Scripting API: Physics.Raycast

You log the position of the gameobject that your raycast hit, not the actual point that you have hit. The actual hit point is hit.point. See the docs.

If you still have trouble debugging what you actually hit, you can also print out the name of the object that your raycast hit:

if(Physics.Raycast(ray, out hit)){
    Debug.Log("We hit: " + hit.transform.name + " at position: " + hit.point);
}

Yeah man. You are only returning the position of the object that your raycast is hitting. If you are trying to find the distance then you should make a Vector3 variable that contains your position minus the position of the object hit by the raycast.

RaycastHit hit;
Ray ray = new Ray(character.cam.transform.position, character.cam.lookDir);
if (Physics.Raycast(ray, out hit))
{
Vector3 magnitude = this.gameObject.transform.position - hit.transform.position;
Debug.Log(magnitude);
}