4/29/2023 0 Comments Godot railroad track spline![]() ![]() ![]() Var point_count = curve.get_point_count() Hey I just wrote this node called SmoothPath based on Ertain's answer.įirst you create straight lines in the editor then press the Smooth button in the Inspector.Įxport(bool) var _straighten setget straighten defining the get_perpendicular_vector() function). I'd like to make this more thorough (i.e. I got the inspiration for this from Rob Spencer's page on Spline Interpolation. Var control_point2 = get_perpendicular_vector(point, -distance)Ĭurve.add_point(point, control_point1, control_point2)ĭraw_polyline(curve.get_baked_points(), red, 2.0) Var control_point1 = get_perpendicular_vector(point, distance) The "distance" variable is how far the control point should be from the originating point. # The "get_perpendicular_vector()" function returns a vector that's a copy of the point, yet has been slid along a line parallel to two neighboring points. So here's some simple, almost pseudo code: var array_of_line_points # This already has the vectors which describe our line You need to add points to a Curve2D object, then adjust the control points of the curve, and then finally draw the curve. May as well promote my comment to an answer. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |