How do I get my wheel mesh to rotate on the proper axis?

I have my model setup with wheel colliders and it drives fine. Everything is working well, including the position of the wheel mesh to simulate suspension. My only issue is that when I run the game, my wheels rotate 90 degrees on the Y axis and then roll along sideways. How can I rotate the mesh in the script so that it displays properly? I mainly only need position, but using wheel.getworldpose forces me to use Quaternion and Vector3. Can I do this without using Quaternion?

Heres an Image…

And heres the code Im using to update my wheel position and rotation…

 // Visual updates
    void Update()
    {
        if (!driveable)
        {
            return;
        }

        // SETUP WHEEL MESHES

        // Turn the mesh wheels
        frontLeftWheelWrapper.localEulerAngles = new Vector3(0, 0, steerAngle);
        frontRightWheelWrapper.localEulerAngles = new Vector3(0, 0, steerAngle);

        // Wheel rotation
        frontLeftWheelMesh.Rotate(0, 0, wheelFL.rpm / 60 * 360 * Time.deltaTime);
        frontRightWheelMesh.Rotate(0, 0, wheelFR.rpm / 60 * 360 * Time.deltaTime);
        rearLeftWheelMesh.Rotate(0, 0, wheelRL.rpm / 60 * 360 * Time.deltaTime);
        rearRightWheelMesh.Rotate(0, 0, wheelRR.rpm / 60 * 360 * Time.deltaTime);

        //Wheel Position
        foreach (WheelCollider wheel in m_Wheels)
        {

            Quaternion q;
            Vector3 p;
            wheel.GetWorldPose(out p, out q);

            // Assume that the only child of the wheelcollider is the wheel shape.
            Transform shapeTransform = wheel.transform.GetChild(0);
            shapeTransform.position = p;
            shapeTransform.rotation = q;
        }

The easiest fix I have seen is to 1. Create an empty game object, 2. align empty’s rotation with the car body (as in the z axis is perpendicular to the side of the car). 3. Take the wheel mesh and make it the child of the empty game object. 4. Use those newly created objects as the wheel mesh. In my experience, the way the wheel spins has to do with how the axes have been assigned on import.

So, making an object the child of an empty object allows you to essentially rotate the axes on your child without actually moving/rotating the child

same problem man please help me
may be you found that solution
please

I ended up having this issue as well. I eventually solved it in the following manner…

  1. Created a top-level empty game object as suggested

  2. Added colliders empty game object and put all wheel colliders in game objects

  3. Added a wheels game object parallel to colliders and rotated the y-axis 90 degrees so the wheels looked correct; moved wheels to proper locations

  4. Each Wheel has its own class… added a rotationDelta Quaternion to adjust the wheel transform during update. The class needs both the mesh and collider transform.

    void Start()
    {
        wheelTransform = GetComponentInChildren<MeshRenderer>().GetComponent<Transform>();
        rotationDelta = Quaternion.FromToRotation(wheelColliderTransform.transform.forward, wheelTransform.transform.forward);
    }
    
    void Update()
    {
        wheelCollider.GetWorldPose(out Vector3 pos, out Quaternion rot);
        wheelTransform.position = pos;
        wheelTransform.rotation = rot * rotationDelta;
    }
    

I’ll give my code that solved the issue (just add 90 degree to Z axis using quaternion)
foreach (WheelCollider wheel in m_Wheels)
{

        Quaternion q;
        Vector3 p;
        wheel.GetWorldPose(out p, out q);

        // Assume that the only child of the wheelcollider is the wheel shape.
        Transform shapeTransform = wheel.transform.GetChild(0);
        shapeTransform.position = p;
        
        Vector3 euler = q.eulerAngles;
        euler.z += 90;
        rot.eulerAngles = euler;
        shapeTransform.rotation = rot;
    }