One way to do it is by sampling the height function. The terrain’s generated with a 3D noise function that creates a single number from any x, y, z position you give it.
You start out by mapping each vertex position onto a perfect sphere (i.e.
Normalize(vertexWorldPosition)*planetRadius), and then you give this to the noise function to generate a height which is applied as a delta from the perfect sphere position.
If you did the same thing with your colliding object position, you could work out the ground height underneath it and just do a height comparison to see how far under/above the ground you are.
In different projects with planar terrains which aren’t adaptive, you know the entire world is a regularly spaced vertex grid so you can do triangle intersection tests (there’s an example of that in my chunked terrain project!)