This is happening because transform.forward is normalized vector showing just direction where your character is looking, but not related to it’s position. Wherever you move your player object, transform.forward will stay on sphere 1 radius around (0,0,0). Use transform.position + transform.forward to cast capsule at 1 meter in front of the player object.
Okay so, for future reference if anybody has this problem I think I understand what I was doing wrong.
First of all getting radius and height of a collider returns the actual number that is set in the inspector. If these have been scaled down by setting a scale value on the object they’re attached to that will not be counted. In my case, both my height and my radius were much bigger than they should’ve actually been in my scene since my player object was set to Scale (.2, .2, .2)
Secondly, I had to start casting my capsule above the actual capsule collider attached to my player. I’m not sure why this is, but that fixed it for me.
always keep the player scale at vector one. if you want to change the model size add another gameobject inside the player and put the model in/on that. then scale that new object. that way everything else is unaffected in this way
I don’t know if this is still relevant for someone but I wrote a little struct that contains the needed arguments for capsule casting and overlap collisions accounting for the object’s global scale.