Car moving in right direction.

I am a unity beginner and making a simple car game. I have set the wheel collider according to this tutorial car tutorial

When i give torque the car is moving forward but also in right direction.

Here is my code

 private void FixedUpdate () 
    {
       FL_WheelMesh.Rotate(FL_WheelCollider.rpm/60f * 360f * Time.deltaTime, 0f, 0f);
       FR_WheelMesh.Rotate(FR_WheelCollider.rpm/60f * 360f * Time.deltaTime, 0f, 0f);
       RL_WheelMesh.Rotate(RL_WheelCollider.rpm/60f * 360f * Time.deltaTime, 0f, 0f);
       RR_WheelMesh.Rotate(RR_WheelCollider.rpm/60f * 360f * Time.deltaTime, 0f, 0f);
 
       FL_WheelCollider.motorTorque = currentTorque;
       FR_WheelCollider.motorTorque = currentTorque;
 
       CarMovement();
    }
 
    private void CarMovement()
    {
       switch(carState)
       {
       case CarState.still :
         {
          currentTorque = 0;
         }
         break;
 
       case CarState.accelerate :
         {
          if(currentTorque < maxTorque)
              currentTorque += 10 * Time.deltaTime;
          else 
              currentTorque = maxTorque;
 
         }    
         break;
 
       case CarState.deaccelerate :
         {
          if(currentTorque > 0)
              currentTorque -= 5 * Time.deltaTime;
         }    
         break;
 
       case CarState.brake :
         {
          if(currentTorque > 0)
              currentTorque -= 10 * Time.deltaTime;
          else 
              currentTorque = 0;
         }    
 
         break;
 
       default :
         break;
       }
    }
void OnGUI()
{
       if(GUI.RepeatButton(new Rect(600, 350, 100, 50), "UP"))
       {
         Debug.Log("---- ACCELERATE ----- ");
         carState = CarState.accelerate;
       }
 
       if(GUI.RepeatButton(new Rect(600, 450, 100, 50), "DOWN"))
       {
         Debug.Log("---- BRAKE ----- ");
         carState = CarState.brake;
       }
    }

I assume you didn’t share complete code. Try these:

  1. Check your collider/colliders center point and make sure it is centered. Because colliders affects rigidbodies.
  2. Check applied forces and make sure that there isn’t any unnecessary forces applied.
  3. Check your game objects’ vector directions and make sure the objects in the same direction.

Hope these help.