How to set Path2D point positions to another Path2D point positions?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Suleymanov

Having hard time figuring out how to set Path2D point positions to another Path2D point positions.

$Path2D.curve.set_point_position($Path2D_2.curve.get_point_position())

didn’t work. Then I tried the following logic:

for p in $Path2D.curve.get_point_count():
	var pos = $Path2D.curve.get_point_position(p)
	$Path2D_2.curve.set_point_position(p, pos)

It kind of worked but not as expected so it was useless too.

I’m aware of the fact that “handle in” and “handle out” positions need to be addressed too.

:bust_in_silhouette: Reply From: Suleymanov

Never mind, figured it out:

for p in curve.get_point_count():
	var pos = curve.get_point_position(p)
	var handleIn = curve.get_point_in(p)
	var handleOut = curve.get_point_out(p)
	$Path2D.curve.add_point(pos, handleIn, handleOut, p)

Works well.