2d bicycle game

I want to make a 2D bmx game like the ones on teagames.com. I have tried using a car tutorial, removing wheels and deleting the turning script yet the car still sometimes moves along the z-axis when I crash or reverse direction quickly. I guess this is something to do with rigidbody physics and I would like to know how I would do this in "real" 2D as Ive noticed with the "2D" tutorial on the unity website that the physics arnt actually 2d, just the object only move in 2 planes.

Thanks in advance.

Well, unity is a 3D engine but you could try declaring the z value again every frame?

Unity will always be in 3D. It is up to how you setup your camera and its properties that determine if you want it to look '2D' or '3D'.

To restrict your bike on the Z axis. Simply do something like the following in your FixedUpdate() method on your bike script.

void FixedUpdate()
{
  rigidbody.transform.position = new Vector3(currentPositionX, currentPositionY, 0);
}

Where currentPositionX and currentPositionY are the bikes positions you set, and notice the Z is set to 0. Meaning it will always stay at 0 on the Z axis.