I am trying to use a Curve2D to draw a Bezier Curve exactly like the documentation:

I found an example of manually calculating all of the points in a Bezier curve, but I'd like to use Curve2D properly so I can take advantage of the Tessellate function which as I understand it will give me a reduced number of points for areas of minimal curvature (the manual example is here: https://github.com/JohnMeadow1/GodotGeometryElements/tree/master/final/bezier_curve)

I am having trouble with adding points to the Curve2D - I believe the mistake is in the "in" and "out" arguments. Can someone help me figure out how I can just get nice control nodes and define a Bezier curve properly so I can tessellate (so I use the Godot functionality of Curve2D properly!)

I have a (very simple) project with 4 Position2D nodes added to it, and the following script: ``````extends Node2D

# https://docs.godotengine.org/en/3.2/tutorials/math/beziers_and_curves.html
var control0 = \$P1.position-\$P0.position
var control1 = \$P3.position-\$P0.position

func _process(delta):
\$LineP0P1.points = Array()
\$LineP2P3.points = Array()

func _draw():
# Draw the handles
draw_circle(\$P0.position,5.0,Color(1.0,0,0,1.0))
draw_circle(\$P1.position,5.0,Color(0,1.0,0,1.0))
draw_circle(\$P2.position,5.0,Color(0,1.0,0,1.0))
draw_circle(\$P3.position,5.0,Color(1.0,0,0,1.0))
var curve_pts = curve.tessellate()
print(curve_pts)
``````

 Where I'm going with this is having movable control and end points, which can interact with another node when it is hovering over them, and that light up when the mouse is near the bezier curve (so the user knows it is selectable). Any shove in the right direction is greatly appreciated. Thanks everyone!

in Engine

You can define the Bezier curve by adding the two points P0 and P3, with "outer" param as (0,0) and "inner" param to be the control points:

`````` func _ready():
# https://docs.godotengine.org/en/3.2/tutorials/math/beziers_and_curves.html
var control0 = \$P1.position-\$P0.position
var control1 = \$P2.position-\$P3.position
Also note the sign change for `control1`.