Contrain local axis when rotating

I’m editing the CarController script beta standard asset’s that Unity has published.
In the PreserveDirectionInAir() method, it has the following code:

rigidbody.MoveRotation(Quaternion.Slerp(rigidbody.rotation, Quaternion.LookRotation(rigidbody.velocity),
Time.deltaTime)); rigidbody.angularVelocity =
Vector3.Lerp(rigidbody.angularVelocity, enter code here`Vector3.zero, Time.deltaTime);

That makes the car rotate in the angle that the car is moving. I basically want to restrict it to only rotate on the cars X axis (so it will stay flat).
My first thought was to just make it Slerp to a Quaternion which had the Y and Z set to the rigidbody.rotation.y and z, and then leave it to rotate towards the x of rigidbody.velocity.
However, that fails because then I’m limiting the global Y and Z axis, not the local - I think anyway.

Any ideas?
Thanks!

To explain the question a bit more, the model looks like this:

alt text

And in that image all rotations are zeroed.

While in the air I need to limit the rotation of the car to only the Y axis (in this case the yellow line) - which would be the plane that the wheels are on.
I can achieve that by using the Freeze Rotation constraints for Y.

However as soon as the car is facing a different angle, that fails because the “Y” axis is no longer the right one.
alt text

I still need to limit it along that yellow line in this image, however the yellow line is local rotation, not global, and I can only seem to lock it on the global axis’.

Not sure of the exact fix since ‘stay flat’ to me means only rotating around the ‘y’, but you might want to read this before attempting to access rotation.y and rotation.z.

The typical solution to this problem would be to zero out one of the components in the Vector3 passed to LookRotation() before making the call. Again, I’m not exactly sure of your geometry, but it would be something like:

var v = rigidbody.velocity;
v.x = 0.0;
var q = Quaternion.LookRotation(v, transform.right);
rigidbody.MoveRotation(Quaternion.Slerp(rigidbody.rotation, q, speed * Time.deltaTime));