Help to create Bycicle physics

I am creating a script to control a bike, but am not having success, I tried with the script below, but when I change the property centerofmass the update, the bike is swaying from side to side and never stops.

Any suggestions?

Script

public class bike : MonoBehaviour {
	public WheelCollider rodafrente;
	public WheelCollider rodatraz;
	
	public int motorpower = 30;
	public int volant = 20;
	
	// Update is called once per frame
	void Update () {
		float inputX;
		float inputY;		
		
		//inputX = Input.acceleration.y;
		inputX = Input.GetAxis("Horizontal");
		inputY = Input.GetAxis("Vertical");
		
		rodatraz.motorTorque = motorpower*inputY;		
		rodafrente.steerAngle = volant*inputX;
		
		if (Input.GetKey("space")) {
			rodafrente.brakeTorque = rodatraz.brakeTorque = 10;
			rodafrente.brakeTorque = rodatraz.brakeTorque = 10;
		}
		else {
			rodafrente.brakeTorque = rodatraz.brakeTorque = 0;
			rodafrente.brakeTorque = rodatraz.brakeTorque = 0;
		}
		rigidbody.centerOfMass = new Vector3(inputX, 0, 0);
	}
}

Hi, welcome to the forum!

Is it possible that the centre of mass ends up below the object? If this happens then it will tend to swing from side to side under the object like a pendulum. You might get better results if you apply forces to keep the bike upright (using AddForceAtPosition) rather than relying purely on the centre of mass for balance.