|
Hi All, 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:
(comments are locked)
|
|
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. IF you plan to control the cylinder via script you should turn the Rigidbody into a kinematic Rigidbody (check isKinematic). Also don't forget to mark an answer as the right answer so the question is marked as solved.
Jun 19 '11 at 09:02 PM
Bunny83
(comments are locked)
|
