Tilting an Object while it Moves

My game involves a plane, controlled using input.acceleration for the iPhone, that moves left and right to avoid buildings. Moving the plane is not an issue, however when i add the code to make it tilt, the plane starts to move down on the y-axis. I have no idea what’s going on. This problem does not occur without the code to tilt. Any and all help would be much appreciated! My code is as follows:

    Vector3 dir = Vector3.zero;
	dir.x = Input.acceleration.x;

	if (dir.sqrMagnitude > 1)
	{
		dir.Normalize ();
	}
	dir = dir * Time.deltaTime;

	transform.Translate(dir * speed);

//this part is the code i add to tilt the plane i.e. where the error occurs

	Vector3 movement = new Vector3 (dir.x, 0.0f, 0.0f);
	rigidbody.velocity = movement * speed;
	rigidbody.rotation = Quaternion.Euler (0.0f, 0.0f, rigidbody.velocity.x * -tilt);

All variables, such as tilt and speed, have been previously initialized as public variables and are manipulated in the game controller. Thanks again for the help!

The problem is that Transform.Translate() uses local coordinates. That is, in your case, it moves to the objects left regardless of how it is angled. You can fix this in a couple of different ways. You can add the Space.World parameter to the Translate():

transform.Translate(dir * speed, Space.World);

Or you can move it by directly accessing transform.position:

transform.position += dir * speed;