+1 vote

Good afternoon my friends.

I have this little character, which is a drag and drop sprite and it produces a line as it is dragged; the drawn line script is on the 2D Line node itself and works fine.
However, sometimes it stops working randomly and does not return to work anymore; could anyone help me to understand my mistake?

Thank you!

the code:

extends Line2D

var target
var point
export (NodePath) var targetPath

func _ready():
    target = get_node(targetPath)
    pass

func _process(delta):
    global_position = Vector2(0,0)
    global_rotation = 0
    point = target.global_position
    add_point(point)

video of issue

in Engine by (174 points)

I experience the same issue with Godot 3.2.1 stable mono.

When the Line2D reaches 2700 Points, funny things start to happen like in your screenshot and video.

3 Answers

0 votes
Best answer

I found the solution to this problem.

In Project Settings go to Rendering > Limits > Buffers and increase the two settings for canvas_polygon_index_buffer_size_kb and canvas_polygon_buffer_size_kb.

The default is 128, which is quite low.

See: https://github.com/godotengine/godot/issues/21793#issuecomment-419025203

by (111 points)
selected by
0 votes

PS: the TargetPath is the Sprite itself

by (174 points)
0 votes

PS²:

sometimes the last point drawn before the bug returns to the 0,0 position and then stops working. but only sometimes.
I think it's related to global_position, but I'm not sure what can be done to correct.

image of 0,0 position bug

by (174 points)
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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.