godotengine / godot-docs

Godot Engine official documentation
https://docs.godotengine.org
Other
3.81k stars 3.09k forks source link

Documentation tab "Creating your first scrip" doesn't cover how the Godot icon revolves even without using "position" variable in script. #9523

Closed amityadav381 closed 3 months ago

amityadav381 commented 3 months ago

Your Godot version: Godot Engine v4.2.2.stable.official.15073afe3

Issue description: Documentation tab "Creating your first scrip" doesn't cover how the Godot icon revolves even without using "position" variable in script.

URL to the documentation page: https://docs.godotengine.org/en/stable/getting_started/step_by_step/scripting_first_script.html#

If you know how to fix the issue you are reporting please consider opening a pull request. We provide a tutorial on using git here: https://docs.godotengine.org/en/stable/community/contributing/pr_workflow.html, writing documentation at https://docs.godotengine.org/en/stable/community/contributing/docs_writing_guidelines.html and contributing to the class reference here: https://docs.godotengine.org/en/stable/community/contributing/updating_the_class_reference.html

AThousandShips commented 3 months ago

What do you mean by "without using position"? Do you mean why it rotates in the first step? That's because you change the rotation property?

amityadav381 commented 3 months ago

Hi @AThousandShips , Thanks for your question.

What I mean by "Godot icon revolves even without using "position"" is that: The Godot icon is expected to only rotate in-place in the first step, as we are not updating "position" variable in the script. But when I tried the 1st step, my Godot icon was also revolving around a point outside the Godot icon, when I had not even created/used the variable "position" in my script.

After some playing with some offsets in the Inspector, I was able to make it rotate in-place. Because of this, I think the documentation is missing something about these offsets.

AThousandShips commented 3 months ago

Then you didn't follow the instructions correctly I'd say, make sure you followed the steps exactly, and I'd it still happens please upload your project here, but this is likely an error in following the instructions

amityadav381 commented 3 months ago

I think the documentation missed explaining about what are:

  1. Sprite2D x,y offset
  2. Node2D x,y position and how "rotation" variable affects each
AThousandShips commented 3 months ago

Please upload your example, you're not following the example, if you did it'd work as the gif, you shouldn't change offset at all, the tutorial doesn't say to do that, that's not part of the tutorial, it's not relevant

amityadav381 commented 3 months ago

Hi @AThousandShips ,

You were right. I made a mistake in following the tutorial. In the final code, I interchanged "speed" with "angular_speed" that's why I was not getting the expected behaviour.

Sorry for the trouble.

amityadav381 commented 3 months ago

I had 2 issues. 1st: Godot icon revolves even without using the position variable in the script. fix: The Godot icon was not centered with Sprite2D. it was at some offset. The tutorial does mention about centering it, but I didn't know what that meant at the time.

2nd: Godot icon was not revolving even after using the position variable as explained in the tutorial script fix: I made a mistake in the script, I accidently replaced speed with angular speed. Which made it look like the icon was rotating in-place.

Both are resolved and now I'm able to move forward with the tutorial. Sorry for the trouble.