x


2d bicycle game

I want to make a 2D bmx game like the ones on http://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.

more ▼

asked Oct 26 '10 at 07:15 PM

Cam gravatar image

Cam
65 5 5 10

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

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.

more ▼

answered Mar 31 '11 at 10:37 AM

Meltdown gravatar image

Meltdown
5.6k 18 25 49

(comments are locked)
10|3000 characters needed characters left

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

more ▼

answered Oct 26 '10 at 08:59 PM

Will 7 gravatar image

Will 7
109 6 8 15

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x1864
x1032
x27

asked: Oct 26 '10 at 07:15 PM

Seen: 1810 times

Last Updated: Oct 26 '10 at 07:15 PM