summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorRyan Hitchman <hitchmanr@gmail.com>2023-09-18 16:30:04 -0600
committerRyan Hitchman <hitchmanr@gmail.com>2023-09-18 18:50:36 -0600
commit734b9d2379c5ad8511f3a4d020dce60bb18abd88 (patch)
tree4f374d7460363ed9280280a0dc83d2ed9f68168e /tests
parente3e2528ba7f6e85ac167d687dd6312b35f558591 (diff)
downloadredot-engine-734b9d2379c5ad8511f3a4d020dce60bb18abd88.tar.gz
Fix Curve3D baking up vectors for nontrivial curves.
The code was modified in 42aa539 to have a different basis vector, but this line was missed and caused up vectors to invert sometimes. Fixes #81879
Diffstat (limited to 'tests')
-rw-r--r--tests/scene/test_curve_3d.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/scene/test_curve_3d.h b/tests/scene/test_curve_3d.h
index 4d7b718d7e..d73bb1ad35 100644
--- a/tests/scene/test_curve_3d.h
+++ b/tests/scene/test_curve_3d.h
@@ -209,6 +209,14 @@ TEST_CASE("[Curve3D] Sampling") {
CHECK(curve->get_closest_point(Vector3(50, 50, 0)) == Vector3(0, 50, 0));
CHECK(curve->get_closest_point(Vector3(0, 100, 0)) == Vector3(0, 50, 0));
}
+
+ SUBCASE("sample_baked_up_vector, off-axis") {
+ // Regression test for issue #81879
+ Ref<Curve3D> c = memnew(Curve3D);
+ c->add_point(Vector3());
+ c->add_point(Vector3(0, .1, 1));
+ CHECK_LT((c->sample_baked_up_vector(c->get_closest_offset(Vector3(0, 0, .9))) - Vector3(0, 0.995037, -0.099504)).length(), 0.01);
+ }
}
TEST_CASE("[Curve3D] Tessellation") {