Problem getting vehicles to stick to the road in an F-Zero style game

I recently started working on a F-Zero style game with some friends and I had some problems with the vehicles. I followed the instructions on this post Creating a Magnetic Vehicles but it quickly starts flying when there is a downhill. The vehicle will also pass through the ground even if he’s levitating like twice his size in height. Here is the script I use to make my vehicle move along the track:

Physics.Raycast(transform.position, -transform.up, hit);
transform.rotation = Quaternion.LookRotation(transform.forward, hit.normal);
idealPosition = transform.position + ((hoverHeight-hit.distance) * hit.normal);
transform.position = idealPosition;

For the direction, I simply rotate the car when the player presses the arrow keys.
For the propulsion, the car simply translate forward by a certain amount determined by his speed.

Could someone point me at what is wrong with my script and how I could improve it?

hey I solved this issue by just altering the gravity like this:

RaycastHit hit;
		if (Physics.Raycast(transform.position, -transform.up, 3f))
		{
			rigidbody.AddForce(-transform.up, ForceMode.Acceleration);
			rigidbody.useGravity = false;
		}
		else
		{

			rigidbody.useGravity = true;
		}

put gravity of rigidbody off in the inspector