[SOLVED] Car jumps when colliding with another car

I am making a racing game. There is an issue that I am facing in it. There is an AI Car in my game, which is really just a rigidbody that looks at the x and z position of some guiders and moves forward continuously. It also has a box collider. On collision with the AI Car, the player’s car jumps over it and eventually flips. I have Googled this problem, but I can’t find the answer. The player’s car is also a rigidbody. It has a box collider covering the body of the car and the wheels have wheel colliders on them only for suspension, otherwise it too takes input the standard way from the user and moves as a normal rigidbody does. The player’s car has a mass of 2000 and the AI Car has a mass of 1804. I use transform.position += transform.forward * carSpeed * Time.deltaTime Any help would be greatly appreciated. Thanks in advance.

Okay so apparently I found the answer myself. transform.forward is the forward position of the GameObject itself. So the problem with the flipping was that as the forward position was changing, so was the direction of acceleration of the car. I recorded a video of the box colliders of both the cars and put it in slow motion to see exactly what was going on. Turns out the box colliders were of the same height making it easier for the player’s car to jump over it and flip. So I extended the height of the box collider of the AI Car. It was somewhat better, but the main problem of the forward position changing couldn’t be solved. I did some more testing on it today and came to find out that adding this line of code was enough: transform.forward = new Vector3(transform.forward.x, 0, transform.forward.z) so the Y angle of the Z axis was always 0. Much better, but on the occasion that the car does jump for some reason, I used a Raycast to find out whether or not the car was on the ground. If it wasn’t, the car’s rigidbody would apply a force of -500000 on the Y axis to yank it down.