From 91e9ad92f5f78dd1578df46205f028599f095357 Mon Sep 17 00:00:00 2001 From: Yaohua Xiong Date: Thu, 24 Nov 2022 20:43:34 +0800 Subject: Refactor baking code for Curve2D The main change is to caculate tangent directly from bezier curve, without going through discretized polyline, avoiding pitfalls of discretization. A similar refacor had been applied to Curve3D. The test cases for Curve2D is updated, comparing floating point with is_equal_approxmiate() instead of `==`, in order to avoid float precision problem. --- scene/2d/path_2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene/2d') diff --git a/scene/2d/path_2d.cpp b/scene/2d/path_2d.cpp index b5945a4562..b68a8fb031 100644 --- a/scene/2d/path_2d.cpp +++ b/scene/2d/path_2d.cpp @@ -177,7 +177,7 @@ void PathFollow2D::_update_transform() { } if (rotates) { - Transform2D xform = c->sample_baked_with_rotation(progress, cubic, loop, lookahead); + Transform2D xform = c->sample_baked_with_rotation(progress, cubic); xform.translate_local(v_offset, h_offset); set_rotation(xform[1].angle()); set_position(xform[2]); -- cgit v1.2.3