Is there a way to restrict rotation for rigidbodies, to only the y-axis?
The reason is that I’m developing a 2d game, and most of the objects are simple planes with textures on them (Sprites). What I want is for them to collide and affect each others trajectory but without any rotation, in order for the plane to be always perfectly facing the camera.
I’m not a programmer, but I just did this with this code attached to the gameobject. My code restricts the Z axis and limits the rotation to only the z rotation.
I don’t know if this is the most efficient way or proper coding to do it. I am looking into it more right now. If it’s only for a few objects then I think you can get away with it.
Testing on a 3G and Iphone 4. With about 14 objects with this code attached. The iPhone 4 ran fine, but the 3G got about 5 fps. taking out this code brought it back up to 30+FPS. I changed to using Configurable joints(Component → Physics -->Configurable Joint) on each object and it gave me the same affect with no FPS hit. So I would say if you only using it on a couple GameObjects then the previous code should be fine. If you have a lot of on screen GameObjects needing this then I would use the Configurable Joint.