How to make object stay certain distance above ground (relative o ground normal)

I am making a game where an object must stay 8 units above the ground at all times. I can do this easily with flat ground since you just add 8 to the hit.point property of the raycast and assign it to the y component of the position of the object, however this does not work when the ground is upside down, vertical, diagonal, etc. I want it relative to the ground normal. So 8 units above (locally) an upside down ground would really be 8 units down in world axis. How would I achieve this? I know some raycasting needs to be done probably, however I am not sure how to approach this.

Nevermind, I seemed to have figured out my problem. For anyone else that is interested, ere is what I got.

         //shoot a raycast relatively downwards
         if (Physics.Raycast(transform.position, -transform.up, out hit, Mathf.Infinity)) 
                {
                    Vector3 pos = hit.point; //get the position where the ray hit the ground

                    //shoot a raycast up from that position towards the object
                    Ray upRay = new Ray(pos, transform.position - pos); 

                    //get a point (vector3) in that ray 8 units from its origin
                    Vector3 upDist = upRay.GetPoint(8); 

                     //smoothly interpolate its position
                    transform.position = Vector3.Lerp(transform.position, upDist, ); 
                }