Solve for the length of line X

No.13254379 ViewReplyOriginalReport
C is the center of a sphere. I also know its radius.
N is a normal coming off the incline that I can use to determine its angle.
X is the leftover space between the bottom of the sphere and the ground plane as it collides with the incline.
I want to know the length of X with what I have. I could get more information if I need it, but i dont want to bloat my code too much. I'm sure this is a solved problem I just dont know enough to research it.

The practical explanation of what I'm doing is, I have a physics active character walking around in a game. He goes flying off of inclines when he goes walking up or down them. The conventional solution is to test for the floor a small distance from the bottom of the object and to snap the object to the appropriate y axis given it's less than a certain distance away. But when the collider sits on an incline there's actually a little bit of space between the bottom of the collider and the floor. The result with my fix is the character is continually moved into intersection with the incline, kicked out to the side, then immediately moved down again. The character slides down all slopes, and it is very difficult to walk up them.
If I know X then I can just add an offset value to my existing code which snaps the character to the floor. If there's an easier way to do it I'm interested.