I'm currently at the concept stage for a Pseudo 2D Sidescroller. I would like to implement the world in 3D using camera viewing the world from oneside.
I would like to constrain physics based movement of most of the game objects to X, Y by placing them between two (invisible) box colliders like shown below (Top View):
========================================= Back Collider Plane
Projectile ---> Obj1 Obj2 ObjN
========================================= Front Collider Plane
Would that work reliably or only in theory?
On our project, we had initially done this very thing, but it caused a lot of physics glitches and you could never be 100% sure that the objects were lined up in a plane, which can be useful sometimes.
Unity has an object called the "Configurable Joint" which we USED TO use for this sort of thing. It has options for freezing motion and rotation along an axis, though it is kind of a confusing component.
In the last couple versions of Unity (maybe starting with 3.2?) the Rigidbody component has a constraints property. You can use this to freeze movement in the Z direction. You'll probably also want to freeze rotation along X and Y. This is the solution we use and it works fine.
I Dont think so, saw a game on the mac app store, called Topple Drop, that sometimes falls forward or backward, so x, y and z.
i would go into the rigidbody -> constraints settings and choose Z under freeze position ;)
My Game Pixel Pig is a 2.5D Pachinko Game. You can play the version on Kongregate here: http://www.kongregate.com/games/ownzilla/pixel-pig
That version of the game has a physics setup like you are describing. The pig is basically sandwiched between two giant block colldiers. You can see he moves slightly forward and slightly backward if you look closely (it's tough to see because of the ortho camera.)
In the iPhone/IPad version I have recently changed to the Lock Z method on the rigid body described in the other two answers. This has basically solved all of my physics problems. Previously I had major issues with the pig getting mixed up with the plunger, locking the pig has solved all the issues I'm aware of. I also have a sneaking suspicion it had a positive effect on performance which is key with fast-moving physics objects. You get weird things happening when your game dips below 10FPS in extreme physics situations. (Only really an issue on mobile platforms.)