if (Input.GetKey ("w")) {
rigidbody.AddForce (0,0,moveSpeed);
}
if (Input.GetKey ("a")) {
transform.Rotate (0, 0, 20000 * Time.deltaTime);
}
if (Input.GetKey ("s")) {
rigidbody.AddForce (0,0,-moveSpeed);
}
Basically I have a ball with rigid body and I move it by adding force, now I want to rotate it when I click A and D. so it changes direction, I tried several rotations, including local rotate of transform, normal rotate and adding torque but ball spins in place, it kinda does not change direction.
O_O its like unruly pet ball
i think the problem is that you're adding a force but always in the same direction (along positive z axis). you don't want to rotate the ball but rotate the force. try calculating a new force vector that is rotated in the direction you want to move and then add that force to the ball.