CapsuleCast center

When you cast a primitive, Raycast.distance gives you the distance the primitive traveled along the direction before the first collision. If I want to then calculate the position of the primitive where the collision occurred, I need to do something like this: contactPosition = castStartPosition + castDirection * hit.distance

For SphereCast this is straightforward, since you pass the center of the sphere directly to the function, but what about CapsuleCast? It accepts the points of the bottom and top spheres defining a capsule, so what is the position of it?

If I add vector castDirection * hit.distance to both points, the result will be two points defining a new capsule, but then I need to end up with one point that I can assign to the transform. Does unity treat it like capsuleCenter = (capsulePoint1 + capsulePoint2) * 0.5f - colliderCenterOffset, or is there more to it?

Not sure what you’re really asking but the capsule collider has both center, and offsets which defines the collider within the transform. It’s also affected by the transform position, rotation, and scale. With results not always whats expected, if rot, and scale differs a lot from 0,0,0, respectively 1,1,1, including all parents all the way to the top.