mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
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.
This commit is contained in:
@@ -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]);
|
||||
|
||||
Reference in New Issue
Block a user