I'm trying out some of my first ever scripting by creating a simple scene where I am trying to move a cylinder along the X-Axis. I have written the following but whenever I attempt to move the object via the right or left arrow keys instead of moving directly along the X-Axis my object appears to also rotate slightly around the Z-axis.
Can anyone give me a pointer or advise what it is I'm doing wrong? Thanks, code listing of my script which is attached to a cylinder with a rigidbody that is placed on top of a plane:
Oops, typically I've just answered my own question. I had a rigid Body on the cylinder and didn't notice there was an attribute on the it named FreezeRotation. I ticked this and it solved my problem.
answered Jun 19 '11 at 08:26 PM