mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 08:23:29 +00:00
GDScript: Clarified/fixed inaccuracies in the built-in function docs.
The input to smoothstep is not actually a weight, and the decscription
of smoothstep was pretty hard to understand and easy to misinterpret.
Clarified what it means to be approximately equal.
nearest_po2 does not do what the descriptions says it does. For one,
it returns the same power if the input is a power of 2. Second, it
returns 0 if the input is negative or 0, while the smallest possible
integral power of 2 actually is 1 (2^0 = 1). Due to the implementation
and how it is used in a lot of places, it does not seem wise to change
such a core function however, and I decided it is better to alter the
description of the built-in.
Added a few examples/clarifications/edge-cases.
(cherry picked from commit 7f9bfee0ac
)
This commit is contained in:
parent
5e978d1df5
commit
347a9df0a1
3 changed files with 33 additions and 17 deletions
|
@ -1715,7 +1715,7 @@ MethodInfo GDScriptFunctions::get_info(Function p_func) {
|
|||
return mi;
|
||||
} break;
|
||||
case MATH_SMOOTHSTEP: {
|
||||
MethodInfo mi("smoothstep", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "weight"));
|
||||
MethodInfo mi("smoothstep", PropertyInfo(Variant::REAL, "from"), PropertyInfo(Variant::REAL, "to"), PropertyInfo(Variant::REAL, "s"));
|
||||
mi.return_val.type = Variant::REAL;
|
||||
return mi;
|
||||
} break;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue