How to use add_child function with "fixed interval"?

Godot Version

4.2.2

Question

i want drawing line like painting software.
i add circle shape scene for line,it is same mechanism painting software.

but when i speed up cursor speed,circle gap is to wide.
how to fix this problem?please telll me your idea.

extends Node2D

var texture_scene = load("res://scene/texture_scene.tscn")
var distance_threshold = 10

var now_point: Vector2
var last_point: Vector2
func _process(delta: float) -> void:
	now_point = get_global_mouse_position()
func _input(event: InputEvent) -> void:
		add_child(addTexture(now_point))

func addTexture(texPos: Vector2) -> Node2D:
	var new_texture = texture_scene.instantiate()
	new_texture.position = texPos
	return new_texture

You could draw a rectangle in between the circles with a height matching the diameter.

I would love to recommend drawing to an Image, should be much more performant by not adding children.

You are going to have to determine the path from point to point and fill it in.
I am with gertkeno and say that adding children for this is not a great way to go about it.
Even a small line is going to add hundreds of child nodes to the tree.
I would look at the various draw functions available to CanvasItem derived nodes like Control or Node2D.
Here is a tutorial for something similar using GODOT 3.x

thanks for comment.
what is “drawing to an Image”?

and i want apply rigidbody2d for drawing line.
because i want make physics puzzle game like this.

sorry,i forget to say that.

can i use physics with “drawing to an Image” solution?

thanks for comment.
I’m sorry, I forgot to mention this.

I want to make the drawn lines into rigidbodies, but is it possible to do that with drawing using CanvasItem?
I was trying to create a drawing with Line2D. However, I realized that it’s not possible to draw a simple circle with Line2D.