This is probably the most random problem I've ever had, but here goes nothin'. I'm making a game about Sgid (don't ask) and I wrote a script to make him float around. The script looks like this: Code (csharp): function Update () { if (Input.GetButton("right")) { transform.Rotate (0, 8, 0); } if (Input.GetButton("left")) { transform.Rotate (0, -8, 0); } if (Input.GetButton("up")) { rigidbody.AddRelativeForce (Vector3.forward * 15); } if (Input.GetButton("down")) { rigidbody.AddRelativeForce (Vector3.back * 15); } if (Input.GetButton("FloatUp")) { rigidbody.AddRelativeForce (Vector3.up * 15); } if (Input.GetButton("FloatDown")) { rigidbody.AddRelativeForce (Vector3.down * 15); } } But when I press the button for FloatUp he floats up while rotating counter-clockwise. Why is he rotating?
Maybe some of the keyboard mapping are mapped to the same key. Just some suggestions for the script. It is a lot easier, faster and works with joysticks to use axes instead of if's. Code (csharp): if (Input.GetButton("right")) { transform.Rotate (0, 8, 0); } if (Input.GetButton("left")) { transform.Rotate (0, -8, 0); } becomes this: Code (csharp): transform.Rotate (0, Input.GetAxis("Horizontal") * 8, 0); secondly you want to make it frame rate independent by multiplying with delta time: Code (csharp): transform.Rotate (0, Input.GetAxis("Horizontal") * 200 * Time.deltaTime, 0); This makes it rotate exactly 200 degrees per second, independent of frame rate. You can apply the same GetAxis instead of if (button ) technique to the addforce calls.