does anyone know how i can make a object rotate on the x axis depending on the object its on?

I’m working on a car controller and im trying to make the body rotate on the x axis to the same thing as the object its on
and i cant get it to work


 public void OnCollisionEnter(Collision collision)
 {

     float tRot = collision.transform.rotation.eulerAngles.x;

     Vector3 cRot = body.transform.rotation.eulerAngles;

     Quaternion targetRotation = Quaternion.Euler(tRot, 0, 0);
    

    

    StartCoroutine(SmoothRotate(targetRotation));
 }

 public IEnumerator SmoothRotate(Quaternion targetRotation)
 {
     float d = 0.1f;
     float e = 0f;

     Quaternion inRot = body.rotation;

     while (e < d)
     {
         e += Time.deltaTime;
         body.rotation = Quaternion.Slerp(inRot, targetRotation, e / d);
         yield return null;

     }

     body.rotation = targetRotation;
 }