Running on draw without start the run - print function random data !?

Godot Version

v4.3.beta2.official [b75f048], tested with this stable version: v4.2.stable.official [46dc277]

Question

I try to follow this tutorial: https://www.youtube.com/watch?v=TtziEJZtWXc
I got errors on print and push_error(“test error”, draw_pos)
the @tool can print the output and push_error gives me the same random data and the icons are not set on positions.
see this bug open and project zip file on the running on draw without start the run - print function random data !? · Issue #93542 · godotengine/godot · GitHub

I don’t think this is an error, your project files do not even have a push_error call. What do you expect to happen? and what is really happening? It seems to draw a radial wheel just fine

1 Like

if you open the project and run it you will see the icons are not show
the print and later push_error are used to see where the icon is drawn, but you can see it comes with random data for this line of source code:

push_error(“test error”, draw_pos)

You are confusing + with * often, multiplying where it should be addition.

var mid_rads = (start_rads + end_rads) / 2.0 * -1
var radius_mid = (inner_radius + outer_radius) / 2

var draw_pos = radius_mid * Vector2.from_angle(mid_rads) + offset

Every + in this snippet is a * in your script.

I think offset was also declared with a *. Any midpoint calculation is (a + b) / 2 so look out for those.

2 Likes

ok, the icons work, I debug and tested with:
... + offset before opening that issue on GitHub …
and draw_pos show me some values …
… now are:

draw_pos : (97.13706, 97.1371)
draw_pos : (97.13708, -129.1371)
draw_pos : (-129.1371, -129.1371)
draw_pos : (-129.1371, 97.13707)
draw_pos : (97.13706, 97.1371)
draw_pos : (97.13708, -129.1371)
draw_pos : (-129.1371, -129.1371)
draw_pos : (-129.1371, 97.13707)
draw_pos : (97.13706, 97.1371)

I think there is something wrong with my operating system, it is not the first time when I got strange behavior.

What do you expect these values to equal? This seems very correct, the first icon has x position 97.13 and y position 97.13, the upper right quadrant. Since you have four icons you see these values form a square with values in each quadrant.

  • Going clockwise the y value is decreased to -129.13
  • Then to the third quadrant, the x value is decreased to -129.13
  • The fourth quadrant increases the y back to 97.13
  • Finally we are back to first quadrant, increasing x back to 97.13

There will be some precision errors due to floating points, i.e 97.13706 vs 97.13708, but theses are so minor-subpixel imprecisions they are invisible to your game.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.