0 votes

I read values from a file, calculate delta from previous to current and use draw_line in _draw from previous Vector2 to current Vector2. The Vector2 are stored in a list/array and all lines are redrawn at each interval.

But after a short time, a minute or so, the values in Godot diverge. I confirm accurate values from a python program.

I thought it might be some rounding like floor/ceiling but ruled that out and made sure I use floats.

Since I don't know what's going wrong I can only guess that there is some kind of caching or some math errors in Godot.

The calculation I do is simply:

asked May 16 in Engine by jitterbeetle (25 points)
edited May 16 by jitterbeetle

Update #2:

After looking at this even more, it seems related to a bug(s). On github there are a few issues related to floats and Vector2 and this issue sort of matches what I am seeing. https://github.com/godotengine/godot/issues/17971

Update #1:

I thought I found a work around. Instead of using the list/array of Vector2 and drawing all the lines from the Vector2 list/array at each interval, I found I can use:


which keeps the drawn lines and only refreshes if I need it. This way I only need
the previous Vector2 and the new Vector2.

But now I've encountered another feature or bug. If focus leaves the Godot
window no line drawing takes place and when focus is restored there are gaps
in the line. The gaps are equal in size to the amount of time focus was gone.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.