From 86b14496b1ab01be1ec4ab133cb73c6fc8c0b6e4 Mon Sep 17 00:00:00 2001 From: Haoyu Qiu Date: Fri, 29 Apr 2022 13:25:48 +0800 Subject: [PATCH] Document lerp_angle behavior when angles are approximately PI apart (cherry picked from commit 492903a0b221ac50c5db0426d22db2457f946b58) --- modules/gdscript/doc_classes/@GDScript.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/gdscript/doc_classes/@GDScript.xml b/modules/gdscript/doc_classes/@GDScript.xml index 607b93a0a27..4bab9fcc2b7 100644 --- a/modules/gdscript/doc_classes/@GDScript.xml +++ b/modules/gdscript/doc_classes/@GDScript.xml @@ -521,6 +521,7 @@ rotation = lerp_angle(min_angle, max_angle, elapsed) elapsed += delta [/codeblock] + [b]Note:[/b] This method lerps through the shortest path between [code]from[/code] and [code]to[/code]. However, when these two angles are approximately [code]PI + k * TAU[/code] apart for any integer [code]k[/code], it's not obvious which way they lerp due to floating-point precision errors. For example, [code]lerp_angle(0, PI, weight)[/code] lerps counter-clockwise, while [code]lerp_angle(0, PI + 5 * TAU, weight)[/code] lerps clockwise.