3D - Object rotates and jumps weirdly when moving from point A to point B

I am trying to make a simple 3D Tank game, where the enemy tanks go from one random coordinates to another. When they spawn, they are aligned to the ground, like this

And most of them move around just fine, but sometimes they start rotating up when moving forward, and then they get like this, and start jumping up and down

What could be the reason for this, they are not colliding with anything that would interfere with their movement?

if I need to provide more info, please ask

EDIT: Here’s the script for movement

void MoveToTarget() {
		transform.position = Vector3.MoveTowards(transform.position, targetCoords, moveSpeed * Time.deltaTime);
        transform.LookAt(targetCoords);
	}

The problem happens if the coordinates for lookat has a different y-value than the object. This is easy to fix. Replace this:

transform.LookAt(targetCoords);

with:

Vector3 targetAtHeight = targetCoords;
targetAtHeight.y = transform.position.y;
transform.LookAt(targetAtHeight);

This will cause your tanks looking at behaviour to be 2D only.

To keep the LookAt method from affecting the x and z rotation, you can construct a new Vector3 with X and Z coordinates from the target and the Y coordinate from the enemy itself.

Vector3 targetVector = new Vector3(target.transform.position.x, this.transform.position.y, target.transform.position.z);
        transform.LookAt(targetVector);

This will keep the tank from tilting when moving as the target always is on the same y-position as itself.

To keep it from jumping you could also lock the y-position of the rigidbody component, but i would suggest looking at wheel colliders instead. I think you can eliminate all these problems by adding “wheels” to your tank. Unity - Manual: Create a vehicle with Wheel Colliders