Hello, I have followed along with the coding as in the tutorial chapter “Add Torque to Rotate” but for some reason it is telling me that it does not work, that it’s Error CS1503. I am very new to coding, so is there any suggestions on what I can do to fix this? Thank you
Hi Alyah,
That’s odd. I’ve just checked the Unity API, and the AddTorque method still expects a float. Your code is correct.
Have you already tried to restart Unity and Visual Studio Code?
If so, please go to Edit > Preferences > External Tools (in Unity) and click “Regenerate project files”. Maybe that will fix the issue.
See also:
- Forum User Guides : How to mark a topic as solved
This is correct and also not.
The Rigidbody
used here expects a Vector3
or 3 float values for x, y and z.
The problem is that the reference is a Rigidbody
and not a Rigidbody2D
. Change it to Rigidbody2D
and it will work as expected
Good catch! And one of the reasons why I don’t like to read code on screenshots.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.