Even this won`t work in Update without any key check:
rigidbody2D.AddTorque(5f);
Yes script is attached, Yes object has Rigidbody2D. As I said, AddForce works, just torque not. Is Kinematic and Fixed angle are Checked OFF.
Please help I am getting hopeless.
There's two possible reasons I can think of off the top of my head: 1: The rigidbody2D is kinematic. Then physics (such as torque) won't be applied to it 2: The rigidbody2D is has fixed angle turned on. In that case, it won't be rotated by torque
public float rotationSpeed; //And now you assaign it in inspector
void FixedUpdate()
{
rigidbody2D.AddTorque(Input.GetAxis ("Horizontal") * rotationSpeed);
}
It wont work. Because its bugged. But when you don`t assaign it in the inspector, it works fine.
Had the exact same problem and solution. Thanks so much for posting! (You would think the people over at Unity would have fixed something like this by now...)
I still have this problem, Unity 2020.1. How should I fix it, so I can change the value from the inspector? Hard coding a value works, just like you wrote here, but I don't think it's an ideal solution :)
There's two possible reasons I can think of off the top of my head: 1: The rigidbody2D is kinematic. Then physics (such as torque) won't be applied to it 2: The rigidbody2D is has fixed angle turned on. In that case, it won't be rotated by torque
– BasteNope, both are checked OFF.
– Wrymnn