- Home /
"Restricting" a GameObject to just X & Y axis
Hey there, I creating a 2d side-scrolling game and I want the whole game to completely out rule the Z axis. Simple question really.. is this possible, if so how do I go about it.
Thanks -C
Answer by Illogical-Ironical · Feb 27, 2011 at 07:24 AM
If you're using a rigidbody component, you can check it's properties in the Inspector panel, and in the option "Constraint" you can fix the Z position.
Answer by doomprodigy · Feb 26, 2011 at 11:49 PM
Unsure if this is what you are looking for but to stop an object moving on the Y Axis use.
transform.eulerAngles = new Vector3(0,transform.eulerAngles.y,0);
Untested*
Peace, Aaron Lewis
Answer by Dethl · Feb 27, 2011 at 04:30 AM
Hi!, I'm not an expert but i did something like that a few weeks ago Following this Tutorial by Will Goldstone, the script in the tutorial is really basic and I guess your's is 100 times more complex and elaborated that this one, but This might give you an idea of how to do it :D
Answer by Alex Cook · Feb 27, 2011 at 05:23 PM
Check out the 2D Side Scrolling tutorial at:
http://unity3d.com/support/resources/tutorials/2d-gameplay-tutorial.html