Tank moving to the right slightly

Ok, so basically my problem is the fact that my GameObject, which is a tank that I made, has a slight rotation to the right for whatever reason. Before I start the game all the rotations are at 0, but when I start moving forward using :

if(Input.GetKey(KeyCode.UpArrow)) {

      rigidbody.velocity = transform.forward * speed;


the tank starts going slightly to the right.

Actually I just watched the rotations when I started the game and for some reason, all the rotations suddenly change just a teensy bit which is why it’s moving to the right slightly, does anyone know why this happens?

Also, after I rotate using :

transform.Rotate(-Vector3.up * Time.deltaTime * speed * RotateSpeed, Space.World);

It doesn’t immediately stop when I stop rotating, it just adds a teensy bit afterwards which makes it so when I move forward it’s still going to the right slightly.

Sorry if this isn’t making much sense, please tell me if it isn’t and I’ll try explaining better. But this is a very annoying problem.

At start :



When I click play :


When I move forward a bit :


EDIT: BTW, I am using C#

I have figured out the problem, but I have absolutely NO idea why this is happening.
So basically, it’s something to do with my box collider, I disabled my box collider and it went through the ground but was not moving to the right. Then I tried fiddling around with the box collider making it smaller or bigger and stuff, still the same problem.
Then I tried using a mesh collider, same problem. Finally I tried using a capsule collider on the z-axis and it went straight. The only problem is that my tank isn’t exactly a capsule shape. Does anyone have any idea why this is happening? I would really like to fix this problem. Also it worked with a sphere collider, but that is even a more irregular shape for the tank.