Quaternions- how to leave out Y rotations...

I don’t know how correctly leave out the y factor in this code concept

if(Physics.Raycast(raydown, hit, RayDist , 1<<9))

transform.rotation = 

Quaternion.FromToRotation(Vector3.up, hit.normal);

the code itself correctly aligns the object with the ground’s normal, but restricts the object to always to look forward on its y, which blocks my ability to turn or steer with keyboard commands. Is there a way to leave the y rotation out of this equation? Thank you

I think what you really want to do is multiply out the FromToRotation - I guess it would look like this:

  transform.rotation = Quaternion.FromToRotation(transform.up, hit.normal) * transform.rotation;

(Or that multiplication might be the other way around)

You want to use transform.up rather than Vector3.up as this object may not be pointing straight up (which is important when applying it like this).