Force2D

Author: Jonathan Czeck (aarku)

Description
This script will allow you to constrain Unity's physics engine to two dimensions. It works best for rigidbodies that are not connected by physics joints.

Technically, this script constrains the GameObject to the Y-Z plane with rotations only allowed on the X axis.

Usage
Assign this behavior to any GameObject. Do not assign this to RigidBodies that are linked together with joints if you want to keep the physics engine more stable.


 * Note that using this script as is will prevent rigidbodies from sleeping . the workaround will be to check whether the object needs alignment before assigning a value to it.

EDIT: the JS can now be made to constrain to x y or z, and will do so there original non constrained rotations