Global scope constants and functions. A list of global scope enumerated constants and built-in functions. This is all that resides in the globals, constants regarding error codes, keycodes, property hints, etc. Singletons are also documented here, since they can be accessed from anywhere. For the entries related to GDScript which can be accessed in any script see [@GDScript]. $DOCS_URL/tutorials/math/random_number_generation.html Returns the absolute value of a [Variant] parameter [code]x[/code] (i.e. non-negative value). Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported. [codeblock] var a = abs(-1) # a is 1 var b = abs(-1.2) # b is 1.2 var c = abs(Vector2(-3.5, -4)) # c is (3.5, 4) var d = abs(Vector2i(-5, -6)) # d is (5, 6) var e = abs(Vector3(-7, 8.5, -3.8)) # e is (7, 8.5, 3.8) var f = abs(Vector3i(-7, -8, -9)) # f is (7, 8, 9) [/codeblock] Returns the absolute value of float parameter [code]x[/code] (i.e. positive value). [codeblock] # a is 1.2 var a = absf(-1.2) [/codeblock] Returns the absolute value of int parameter [code]x[/code] (i.e. positive value). [codeblock] # a is 1 var a = absi(-1) [/codeblock] Returns the arc cosine of [code]x[/code] in radians. Use to get the angle of cosine [code]x[/code]. [code]x[/code] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method acos] will return [constant @GDScript.NAN]. [codeblock] # c is 0.523599 or 30 degrees if converted with rad2deg(c) var c = acos(0.866025) [/codeblock] Returns the arc sine of [code]x[/code] in radians. Use to get the angle of sine [code]x[/code]. [code]x[/code] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method asin] will return [constant @GDScript.NAN]. [codeblock] # s is 0.523599 or 30 degrees if converted with rad2deg(s) var s = asin(0.5) [/codeblock] Returns the arc tangent of [code]x[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry. The method cannot know in which quadrant the angle should fall. See [method atan2] if you have both [code]y[/code] and [code]x[/code]. [codeblock] var a = atan(0.5) # a is 0.463648 [/codeblock] If [code]x[/code] is between [code]-PI / 2[/code] and [code]PI / 2[/code] (inclusive), [code]atan(tan(x))[/code] is equal to [code]x[/code]. Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant. Important note: The Y coordinate comes first, by convention. [codeblock] var a = atan2(0, -1) # a is 3.141593 [/codeblock] Decodes a byte array back to a [Variant] value, without decoding objects. [b]Note:[/b] If you need object deserialization, see [method bytes2var_with_objects]. Decodes a byte array back to a [Variant] value. Decoding objects is allowed. [b]Warning:[/b] Deserialized object can contain code which gets executed. Do not use this option if the serialized object comes from untrusted sources to avoid potential security threats (remote code execution). Rounds [code]x[/code] upward (towards positive infinity), returning the smallest whole number that is not less than [code]x[/code]. [codeblock] var i = ceil(1.45) # i is 2.0 i = ceil(1.001) # i is 2.0 [/codeblock] See also [method floor], [method round], and [method snapped]. Clamps the [Variant] [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported. [codeblock] var a = clamp(-10, -1, 5) # a is -1 var b = clamp(8.1, 0.9, 5.5) # b is 5.5 var c = clamp(Vector2(-3.5, -4), Vector2(-3.2, -2), Vector2(2, 6.5)) # c is (-3.2, -2) var d = clamp(Vector2i(7, 8), Vector2i(-3, -2), Vector2i(2, 6)) # d is (2, 6) var e = clamp(Vector3(-7, 8.5, -3.8), Vector3(-3, -2, 5.4), Vector3(-2, 6, -4.1)) # e is (-3, -2, 5.4) var f = clamp(Vector3i(-7, -8, -9), Vector3i(-1, 2, 3), Vector3i(-4, -5, -6)) # f is (-4, -5, -6) [/codeblock] Clamps the float [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. [codeblock] var speed = 42.1 # a is 20.0 var a = clampf(speed, 1.0, 20.0) speed = -10.0 # a is -1.0 a = clampf(speed, -1.0, 1.0) [/codeblock] Clamps the integer [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. [codeblock] var speed = 42 # a is 20 var a = clampi(speed, 1, 20) speed = -10 # a is -1 a = clampi(speed, -1, 1) [/codeblock] Returns the cosine of angle [code]angle_rad[/code] in radians. [codeblock] cos(PI * 2) # Returns 1.0 cos(PI) # Returns -1.0 cos(deg2rad(90)) # Returns 0.0 [/codeblock] Returns the hyperbolic cosine of [code]x[/code] in radians. [codeblock] # Prints 1.543081 print(cosh(1)) [/codeblock] Converts from decibels to linear energy (audio). Converts an angle expressed in degrees to radians. [codeblock] # r is 3.141593 var r = deg2rad(180) [/codeblock] Returns an "eased" value of [code]x[/code] based on an easing function defined with [code]curve[/code]. This easing function is based on an exponent. The [code]curve[/code] can be any floating-point number, with specific values leading to the following behaviors: [codeblock] - Lower than -1.0 (exclusive): Ease in-out - 1.0: Linear - Between -1.0 and 0.0 (exclusive): Ease out-in - 0.0: Constant - Between 0.0 to 1.0 (exclusive): Ease out - 1.0: Linear - Greater than 1.0 (exclusive): Ease in [/codeblock] [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/ease_cheatsheet.png]ease() curve values cheatsheet[/url] See also [method smoothstep]. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer]. Returns a human-readable name for the given error code. The natural exponential function. It raises the mathematical constant [b]e[/b] to the power of [code]x[/code] and returns it. [b]e[/b] has an approximate value of 2.71828, and can be obtained with [code]exp(1)[/code]. For exponents to other bases use the method [method pow]. [codeblock] var a = exp(2) # Approximately 7.39 [/codeblock] Rounds [code]x[/code] downward (towards negative infinity), returning the largest whole number that is not more than [code]x[/code]. [codeblock] # a is 2.0 var a = floor(2.99) # a is -3.0 a = floor(-2.99) [/codeblock] See also [method ceil], [method round], and [method snapped]. [b]Note:[/b] This method returns a float. If you need an integer, you can use [code]int(x)[/code] directly. Returns the floating-point remainder of [code]x/y[/code], keeping the sign of [code]x[/code]. [codeblock] # Remainder is 1.5 var remainder = fmod(7, 5.5) [/codeblock] For the integer remainder operation, use the [code]%[/code] operator. Returns the floating-point modulus of [code]x/y[/code] that wraps equally in positive and negative. [codeblock] for i in 7: var x = 0.5 * i - 1.5 print("%4.1f %4.1f %4.1f" % [x, fmod(x, 1.5), fposmod(x, 1.5)]) [/codeblock] Produces: [codeblock] -1.5 -0.0 0.0 -1.0 -1.0 0.5 -0.5 -0.5 1.0 0.0 0.0 0.0 0.5 0.5 0.5 1.0 1.0 1.0 1.5 0.0 0.0 [/codeblock] Returns the integer hash of the variable passed. [codeblock] print(hash("a")) # Prints 177670 [/codeblock] Returns the Object that corresponds to [code]instance_id[/code]. All Objects have a unique instance ID. [codeblock] var foo = "bar" func _ready(): var id = get_instance_id() var inst = instance_from_id(id) print(inst.foo) # Prints bar [/codeblock] Returns an interpolation or extrapolation factor considering the range specified in [code]from[/code] and [code]to[/code], and the interpolated value specified in [code]weight[/code]. The returned value will be between [code]0.0[/code] and [code]1.0[/code] if [code]weight[/code] is between [code]from[/code] and [code]to[/code] (inclusive). If [code]weight[/code] is located outside this range, then an extrapolation factor will be returned (return value lower than [code]0.0[/code] or greater than [code]1.0[/code]). [codeblock] # The interpolation ratio in the `lerp()` call below is 0.75. var middle = lerp(20, 30, 0.75) # `middle` is now 27.5. # Now, we pretend to have forgotten the original ratio and want to get it back. var ratio = inverse_lerp(20, 30, 27.5) # `ratio` is now 0.75. [/codeblock] See also [method lerp] which performs the reverse of this operation. Returns [code]true[/code] if [code]a[/code] and [code]b[/code] are approximately equal to each other. Here, approximately equal means that [code]a[/code] and [code]b[/code] are within a small internal epsilon of each other, which scales with the magnitude of the numbers. Infinity values of the same sign are considered equal. Returns whether [code]x[/code] is an infinity value (either positive infinity or negative infinity). Returns [code]true[/code] if the Object that corresponds to [code]instance_id[/code] is a valid object (e.g. has not been deleted from memory). All Objects have a unique instance ID. Returns whether [code]instance[/code] is a valid object (e.g. has not been deleted from memory). Returns whether [code]x[/code] is a NaN ("Not a Number" or invalid) value. Returns [code]true[/code] if [code]x[/code] is zero or almost zero. This method is faster than using [method is_equal_approx] with one value as zero. Linearly interpolates between two values by the factor defined in [code]weight[/code]. To perform interpolation, [code]weight[/code] should be between [code]0.0[/code] and [code]1.0[/code] (inclusive). However, values outside this range are allowed and can be used to perform [i]extrapolation[/i]. [codeblock] lerp(0, 4, 0.75) # Returns 3.0 [/codeblock] See also [method inverse_lerp] which performs the reverse of this operation. To perform eased interpolation with [method lerp], combine it with [method ease] or [method smoothstep]. Linearly interpolates between two angles (in radians) by a normalized value. Similar to [method lerp], but interpolates correctly when the angles wrap around [constant @GDScript.TAU]. To perform eased interpolation with [method lerp_angle], combine it with [method ease] or [method smoothstep]. [codeblock] extends Sprite var elapsed = 0.0 func _process(delta): var min_angle = deg2rad(0.0) var max_angle = deg2rad(90.0) rotation = lerp_angle(min_angle, max_angle, elapsed) elapsed += delta [/codeblock] Converts from linear energy to decibels (audio). This can be used to implement volume sliders that behave as expected (since volume isn't linear). Example: [codeblock] # "Slider" refers to a node that inherits Range such as HSlider or VSlider. # Its range must be configured to go from 0 to 1. # Change the bus name if you'd like to change the volume of a specific bus only. AudioServer.set_bus_volume_db(AudioServer.get_bus_index("Master"), linear2db($Slider.value)) [/codeblock] Natural logarithm. The amount of time needed to reach a certain level of continuous growth. [b]Note:[/b] This is not the same as the "log" function on most calculators, which uses a base 10 logarithm. [codeblock] log(10) # Returns 2.302585 [/codeblock] [b]Note:[/b] The logarithm of [code]0[/code] returns [code]-inf[/code], while negative values return [code]-nan[/code]. Returns the maximum of the given values. This method can take any number of arguments. [codeblock] max(1, 7, 3, -6, 5) # Returns 7 [/codeblock] Returns the maximum of two float values. [codeblock] maxf(3.6, 24) # Returns 24.0 maxf(-3.99, -4) # Returns -3.99 [/codeblock] Returns the maximum of two int values. [codeblock] maxi(1, 2) # Returns 2 maxi(-3, -4) # Returns -3 [/codeblock] Returns the minimum of the given values. This method can take any number of arguments. [codeblock] min(1, 7, 3, -6, 5) # Returns -6 [/codeblock] Returns the minimum of two float values. [codeblock] minf(3.6, 24) # Returns 3.6 minf(-3.99, -4) # Returns -4.0 [/codeblock] Returns the minimum of two int values. [codeblock] mini(1, 2) # Returns 1 mini(-3, -4) # Returns -4 [/codeblock] Moves [code]from[/code] toward [code]to[/code] by the [code]delta[/code] value. Use a negative [code]delta[/code] value to move away. [codeblock] move_toward(5, 10, 4) # Returns 9 move_toward(10, 5, 4) # Returns 6 move_toward(10, 5, -1.5) # Returns 11.5 [/codeblock] Returns the nearest equal or larger power of 2 for integer [code]value[/code]. In other words, returns the smallest value [code]a[/code] where [code]a = pow(2, n)[/code] such that [code]value <= a[/code] for some non-negative integer [code]n[/code]. [codeblock] nearest_po2(3) # Returns 4 nearest_po2(4) # Returns 4 nearest_po2(5) # Returns 8 nearest_po2(0) # Returns 0 (this may not be what you expect) nearest_po2(-1) # Returns 0 (this may not be what you expect) [/codeblock] [b]Warning:[/b] Due to the way it is implemented, this function returns [code]0[/code] rather than [code]1[/code] for non-positive values of [code]value[/code] (in reality, 1 is the smallest integer power of 2). Returns the [code]value[/code] wrapped between [code]0[/code] and the [code]length[/code]. If the limit is reached, the next value the function returned is decreased to the [code]0[/code] side or increased to the [code]length[/code] side (like a triangle wave). If [code]length[/code] is less than zero, it becomes positive. [codeblock] pingpong(-3.0, 3.0) # Returns 3 pingpong(-2.0, 3.0) # Returns 2 pingpong(-1.0, 3.0) # Returns 1 pingpong(0.0, 3.0) # Returns 0 pingpong(1.0, 3.0) # Returns 1 pingpong(2.0, 3.0) # Returns 2 pingpong(3.0, 3.0) # Returns 3 pingpong(4.0, 3.0) # Returns 2 pingpong(5.0, 3.0) # Returns 1 pingpong(6.0, 3.0) # Returns 0 [/codeblock] Returns the integer modulus of [code]x/y[/code] that wraps equally in positive and negative. [codeblock] for i in range(-3, 4): print("%2d %2d %2d" % [i, i % 3, posmod(i, 3)]) [/codeblock] Produces: [codeblock] -3 0 0 -2 -2 1 -1 -1 2 0 0 0 1 1 1 2 2 2 3 0 0 [/codeblock] Returns the result of [code]base[/code] raised to the power of [code]exp[/code]. [codeblock] pow(2, 5) # Returns 32 [/codeblock] Converts one or more arguments of any type to string in the best way possible and prints them to the console. [codeblock] var a = [1, 2, 3] print("a", "b", a) # Prints ab[1, 2, 3] [/codeblock] [b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. If verbose mode is enabled ([method OS.is_stdout_verbose] returning [code]true[/code]), converts one or more arguments of any type to string in the best way possible and prints them to the console. Prints one or more arguments to strings in the best way possible to standard error line. [codeblock] printerr("prints to stderr") [/codeblock] Prints one or more arguments to strings in the best way possible to console. No newline is added at the end. [codeblock] printraw("A") printraw("B") # Prints AB [/codeblock] [b]Note:[/b] Due to limitations with Godot's built-in console, this only prints to the terminal. If you need to print in the editor, use another method, such as [method print]. Prints one or more arguments to the console with a space between each argument. [codeblock] prints("A", "B", "C") # Prints A B C [/codeblock] Prints one or more arguments to the console with a tab between each argument. [codeblock] printt("A", "B", "C") # Prints A B C [/codeblock] Pushes an error message to Godot's built-in debugger and to the OS terminal. [codeblock] push_error("test error") # Prints "test error" to debugger and terminal as error call [/codeblock] [b]Note:[/b] Errors printed this way will not pause project execution. To print an error message and pause project execution in debug builds, use [code]assert(false, "test error")[/code] instead. Pushes a warning message to Godot's built-in debugger and to the OS terminal. [codeblock] push_warning("test warning") # Prints "test warning" to debugger and terminal as warning call [/codeblock] Converts an angle expressed in radians to degrees. [codeblock] rad2deg(0.523599) # Returns 30 [/codeblock] Random from seed: pass a [code]seed[/code], and an array with both number and new seed is returned. "Seed" here refers to the internal state of the pseudo random number generator. The internal state of the current implementation is 64 bits. Returns a random floating point value between [code]0.0[/code] and [code]1.0[/code] (inclusive). [codeblock] randf() # Returns e.g. 0.375671 [/codeblock] Returns a random floating point value on the interval between [code]from[/code] and [code]to[/code] (inclusive). [codeblock] prints(randf_range(-10, 10), randf_range(-10, 10)) # Prints e.g. -3.844535 7.45315 [/codeblock] Returns a normally-distributed pseudo-random floating point value using Box-Muller transform with the specified [code]mean[/code] and a standard [code]deviation[/code]. This is also called Gaussian distribution. Returns a random unsigned 32-bit integer. Use remainder to obtain a random value in the interval [code][0, N - 1][/code] (where N is smaller than 2^32). [codeblock] randi() # Returns random integer between 0 and 2^32 - 1 randi() % 20 # Returns random integer between 0 and 19 randi() % 100 # Returns random integer between 0 and 99 randi() % 100 + 1 # Returns random integer between 1 and 100 [/codeblock] Returns a random signed 32-bit integer between [code]from[/code] and [code]to[/code] (inclusive). If [code]to[/code] is lesser than [code]from[/code], they are swapped. [codeblock] print(randi_range(0, 1)) # Prints 0 or 1 print(randi_range(-10, 1000)) # Prints any number from -10 to 1000 [/codeblock] Randomizes the seed (or the internal state) of the random number generator. Current implementation reseeds using a number based on time. [b]Note:[/b] This method is called automatically when the project is run. If you need to fix the seed to have reproducible results, use [method seed] to initialize the random number generator. Maps a [code]value[/code] from range [code][istart, istop][/code] to [code][ostart, ostop][/code]. [codeblock] range_lerp(75, 0, 100, -1, 1) # Returns 0.5 [/codeblock] Allocate a unique ID which can be used by the implementation to construct a RID. This is used mainly from native extensions to implement servers. Create a RID from an int64. This is used mainly from native extensions to build servers. Rounds [code]x[/code] to the nearest whole number, with halfway cases rounded away from zero. [codeblock] round(2.6) # Returns 3 [/codeblock] See also [method floor], [method ceil], and [method snapped]. Sets seed for the random number generator. [codeblock] var my_seed = "Godot Rocks" seed(my_seed.hash()) [/codeblock] Returns the sign of [code]x[/code] as same type of [Variant] as [code]x[/code] with each component being -1, 0 and 1 for each negative, zero and positive values respectivelu. Variant types [int], [float] (real), [Vector2], [Vector2i], [Vector3] and [Vector3i] are supported. [codeblock] sign(-6.0) # Returns -1 sign(0.0) # Returns 0 sign(6.0) # Returns 1 sign(Vector3(-6.0, 0.0, 6.0) # Returns (-1, 0, 1) [/codeblock] Returns the sign of [code]x[/code] as a float: -1.0 or 1.0. Returns 0.0 if [code]x[/code] is 0. [codeblock] sign(-6.0) # Returns -1.0 sign(0.0) # Returns 0.0 sign(6.0) # Returns 1.0 [/codeblock] Returns the sign of [code]x[/code] as an integer: -1 or 1. Returns 0 if [code]x[/code] is 0. [codeblock] sign(-6) # Returns -1 sign(0) # Returns 0 sign(6) # Returns 1 [/codeblock] Returns the sine of angle [code]angle_rad[/code] in radians. [codeblock] sin(0.523599) # Returns 0.5 sin(deg2rad(90)) # Returns 1.0 [/codeblock] Returns the hyperbolic sine of [code]x[/code]. [codeblock] var a = log(2.0) # Returns 0.693147 sinh(a) # Returns 0.75 [/codeblock] Returns the result of smoothly interpolating the value of [code]x[/code] between [code]0[/code] and [code]1[/code], based on the where [code]x[/code] lies with respect to the edges [code]from[/code] and [code]to[/code]. The return value is [code]0[/code] if [code]x <= from[/code], and [code]1[/code] if [code]x >= to[/code]. If [code]x[/code] lies between [code]from[/code] and [code]to[/code], the returned value follows an S-shaped curve that maps [code]x[/code] between [code]0[/code] and [code]1[/code]. This S-shaped curve is the cubic Hermite interpolator, given by [code]f(y) = 3*y^2 - 2*y^3[/code] where [code]y = (x-from) / (to-from)[/code]. [codeblock] smoothstep(0, 2, -5.0) # Returns 0.0 smoothstep(0, 2, 0.5) # Returns 0.15625 smoothstep(0, 2, 1.0) # Returns 0.5 smoothstep(0, 2, 2.0) # Returns 1.0 [/codeblock] Compared to [method ease] with a curve value of [code]-1.6521[/code], [method smoothstep] returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer]. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_ease_comparison.png]Comparison between smoothstep() and ease(x, -1.6521) return values[/url] Snaps float value [code]x[/code] to a given [code]step[/code]. This can also be used to round a floating point number to an arbitrary number of decimals. [codeblock] snapped(100, 32) # Returns 96 snapped(3.14159, 0.01) # Returns 3.14 [/codeblock] See also [method ceil], [method floor], and [method round]. Returns the square root of [code]x[/code], where [code]x[/code] is a non-negative number. [codeblock] sqrt(9) # Returns 3 [/codeblock] [b]Note:[/b] Negative values of [code]x[/code] return NaN. If you need negative inputs, use [code]System.Numerics.Complex[/code] in C#. Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation. [codeblock] # n is 0 var n = step_decimals(5) # n is 4 n = step_decimals(1.0005) # n is 9 n = step_decimals(0.000000005) [/codeblock] Converts one or more arguments of any type to string in the best way possible. Converts a formatted string that was returned by [method var2str] to the original value. [codeblock] var a = '{ "a": 1, "b": 2 }' var b = str2var(a) print(b["a"]) # Prints 1 [/codeblock] Returns the tangent of angle [code]angle_rad[/code] in radians. [codeblock] tan(deg2rad(45)) # Returns 1 [/codeblock] Returns the hyperbolic tangent of [code]x[/code]. [codeblock] var a = log(2.0) # Returns 0.693147 tanh(a) # Returns 0.6 [/codeblock] Returns the internal type of the given Variant object, using the [enum Variant.Type] values. [codeblock] var json = JSON.new() json.parse('["a", "b", "c"]') var result = json.get_data() if typeof(result) == TYPE_ARRAY: print(result[0]) # Prints a else: print("Unexpected result") [/codeblock] Encodes a [Variant] value to a byte array, without encoding objects. Deserialization can be done with [method bytes2var]. [b]Note:[/b] If you need object serialization, see [method var2bytes_with_objects]. Encodes a [Variant] value to a byte array. Encoding objects is allowed (and can potentially include code). Deserialization can be done with [method bytes2var_with_objects]. Converts a Variant [code]variable[/code] to a formatted string that can later be parsed using [method str2var]. [codeblock] a = { "a": 1, "b": 2 } print(var2str(a)) [/codeblock] prints [codeblock] { "a": 1, "b": 2 } [/codeblock] Returns a weak reference to an object, or [code]null[/code] is the argument is invalid. A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it. Wraps float [code]value[/code] between [code]min[/code] and [code]max[/code]. Usable for creating loop-alike behavior or infinite surfaces. [codeblock] # Infinite loop between 5.0 and 9.9 value = wrapf(value + 0.1, 5.0, 10.0) [/codeblock] [codeblock] # Infinite rotation (in radians) angle = wrapf(angle + 0.1, 0.0, TAU) [/codeblock] [codeblock] # Infinite rotation (in radians) angle = wrapf(angle + 0.1, -PI, PI) [/codeblock] [b]Note:[/b] If [code]min[/code] is [code]0[/code], this is equivalent to [method fposmod], so prefer using that instead. [code]wrapf[/code] is more flexible than using the [method fposmod] approach by giving the user control over the minimum value. Wraps integer [code]value[/code] between [code]min[/code] and [code]max[/code]. Usable for creating loop-alike behavior or infinite surfaces. [codeblock] # Infinite loop between 5 and 9 frame = wrapi(frame + 1, 5, 10) [/codeblock] [codeblock] # result is -2 var result = wrapi(-6, -5, -1) [/codeblock] The [AudioServer] singleton. The [CameraServer] singleton. The [ClassDB] singleton. The [DisplayServer] singleton. The [Engine] singleton. The [EngineDebugger] singleton. The [Geometry2D] singleton. The [Geometry3D] singleton. The [GodotSharp] singleton. The [IP] singleton. The [Input] singleton. The [InputMap] singleton. The [JavaClassWrapper] singleton. [b]Note:[/b] Only implemented on Android. The [JavaScript] singleton. [b]Note:[/b] Only implemented on HTML5. The [Marshalls] singleton. The [NavigationMeshGenerator] singleton. The [NavigationServer2D] singleton. The [NavigationServer2D] singleton. The [OS] singleton. The [Performance] singleton. The [PhysicsServer2D] singleton. The [PhysicsServer3D] singleton. The [ProjectSettings] singleton. The [RenderingServer] singleton. The [ResourceLoader] singleton. The [ResourceSaver] singleton. The [TextServerManager] singleton. The [Time] singleton. The [TranslationServer] singleton. The [VisualScriptCustomNodes] singleton. The [XRServer] singleton. Left side, usually used for [Control] or [StyleBox]-derived classes. Top side, usually used for [Control] or [StyleBox]-derived classes. Right side, usually used for [Control] or [StyleBox]-derived classes. Bottom side, usually used for [Control] or [StyleBox]-derived classes. Top-left corner. Top-right corner. Bottom-right corner. Bottom-left corner. General vertical alignment, usually used for [Separator], [ScrollBar], [Slider], etc. General horizontal alignment, usually used for [Separator], [ScrollBar], [Slider], etc. Horizontal left alignment, usually for text-derived classes. Horizontal center alignment, usually for text-derived classes. Horizontal right alignment, usually for text-derived classes. Expand row to fit width, usually for text-derived classes. Vertical top alignment, usually for text-derived classes. Vertical center alignment, usually for text-derived classes. Vertical bottom alignment, usually for text-derived classes. Expand rows to fit height, usually for text-derived classes. Aligns the top of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant. Aligns the center of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant. Aligns the bottom of the inline object (e.g. image, table) to the position of the text specified by [code]INLINE_ALIGNMENT_TO_*[/code] constant. Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the top of the text. Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the center of the text. Aligns the position of the inline object (e.g. image, table) specified by [code]INLINE_ALIGNMENT_*_TO[/code] constant to the baseline of the text. Aligns inline object (e.g. image, table) to the bottom of the text. Aligns top of the inline object (e.g. image, table) to the top of the text. Equivalent to [code]INLINE_ALIGNMENT_TOP_TO | INLINE_ALIGNMENT_TO_TOP[/code]. Aligns center of the inline object (e.g. image, table) to the center of the text. Equivalent to [code]INLINE_ALIGNMENT_CENTER_TO | INLINE_ALIGNMENT_TO_CENTER[/code]. Aligns bottom of the inline object (e.g. image, table) to the bottom of the text. Equivalent to [code]INLINE_ALIGNMENT_BOTTOM_TO | INLINE_ALIGNMENT_TO_BOTTOM[/code]. A bit mask for [code]INLINE_ALIGNMENT_*_TO[/code] alignment constants. A bit mask for [code]INLINE_ALIGNMENT_TO_*[/code] alignment constants. Enum value which doesn't correspond to any key. This is used to initialize [enum Key] properties with a generic state. Keycodes with this bit applied are non-printable. Escape key. Tab key. Shift + Tab key. Backspace key. Return key (on the main keyboard). Enter key on the numeric keypad. Insert key. Delete key. Pause key. Print Screen key. System Request key. Clear key. Home key. End key. Left arrow key. Up arrow key. Right arrow key. Down arrow key. Page Up key. Page Down key. Shift key. Control key. Meta key. Alt key. Caps Lock key. Num Lock key. Scroll Lock key. F1 key. F2 key. F3 key. F4 key. F5 key. F6 key. F7 key. F8 key. F9 key. F10 key. F11 key. F12 key. F13 key. F14 key. F15 key. F16 key. Multiply (*) key on the numeric keypad. Divide (/) key on the numeric keypad. Subtract (-) key on the numeric keypad. Period (.) key on the numeric keypad. Add (+) key on the numeric keypad. Number 0 on the numeric keypad. Number 1 on the numeric keypad. Number 2 on the numeric keypad. Number 3 on the numeric keypad. Number 4 on the numeric keypad. Number 5 on the numeric keypad. Number 6 on the numeric keypad. Number 7 on the numeric keypad. Number 8 on the numeric keypad. Number 9 on the numeric keypad. Left Super key (Windows key). Right Super key (Windows key). Context menu key. Left Hyper key. Right Hyper key. Help key. Left Direction key. Right Direction key. Media back key. Not to be confused with the Back button on an Android device. Media forward key. Media stop key. Media refresh key. Volume down key. Mute volume key. Volume up key. Bass Boost key. Bass up key. Bass down key. Treble up key. Treble down key. Media play key. Media stop key. Previous song key. Next song key. Media record key. Home page key. Favorites key. Search key. Standby key. Open URL / Launch Browser key. Launch Mail key. Launch Media key. Launch Shortcut 0 key. Launch Shortcut 1 key. Launch Shortcut 2 key. Launch Shortcut 3 key. Launch Shortcut 4 key. Launch Shortcut 5 key. Launch Shortcut 6 key. Launch Shortcut 7 key. Launch Shortcut 8 key. Launch Shortcut 9 key. Launch Shortcut A key. Launch Shortcut B key. Launch Shortcut C key. Launch Shortcut D key. Launch Shortcut E key. Launch Shortcut F key. Unknown key. Space key. ! key. " key. # key. $ key. % key. & key. ' key. ( key. ) key. * key. + key. , key. - key. . key. / key. Number 0. Number 1. Number 2. Number 3. Number 4. Number 5. Number 6. Number 7. Number 8. Number 9. : key. ; key. < key. = key. > key. ? key. @ key. A key. B key. C key. D key. E key. F key. G key. H key. I key. J key. K key. L key. M key. N key. O key. P key. Q key. R key. S key. T key. U key. V key. W key. X key. Y key. Z key. [ key. \ key. ] key. ^ key. _ key. ` key. { key. | key. } key. ~ key. Non-breakable space key. ¡ key. ¢ key. £ key. ¤ key. ¥ key. ¦ key. § key. ¨ key. © key. ª key. « key. ¬ key. Soft hyphen key. ® key. ¯ key. ° key. ± key. ² key. ³ key. ´ key. µ key. ¶ key. · key. ¸ key. ¹ key. º key. » key. ¼ key. ½ key. ¾ key. ¿ key. À key. Á key. Â key. Ã key. Ä key. Å key. Æ key. Ç key. È key. É key. Ê key. Ë key. Ì key. Í key. Î key. Ï key. Ð key. Ñ key. Ò key. Ó key. Ô key. Õ key. Ö key. × key. Ø key. Ù key. Ú key. Û key. Ü key. Ý key. Þ key. ß key. ÷ key. ÿ key. Key Code mask. Modifier key mask. Shift key mask. Alt key mask. Meta key mask. Ctrl key mask. Command key mask. On macOS, this is equivalent to [constant KEY_MASK_META]. On other platforms, this is equivalent to [constant KEY_MASK_CTRL]. This mask should be preferred to [constant KEY_MASK_META] or [constant KEY_MASK_CTRL] for system shortcuts as it handles all platforms correctly. Keypad key mask. Group Switch key mask. Enum value which doesn't correspond to any mouse button. This is used to initialize [enum MouseButton] properties with a generic state. Left mouse button. Right mouse button. Middle mouse button. Mouse wheel up. Mouse wheel down. Mouse wheel left button (only present on some mice). Mouse wheel right button (only present on some mice). Extra mouse button 1 (only present on some mice). Extra mouse button 2 (only present on some mice). Left mouse button mask. Right mouse button mask. Middle mouse button mask. Extra mouse button 1 mask. Extra mouse button 2 mask. An invalid game controller button. Game controller SDL button A. Corresponds to the bottom action button: Sony Cross, Xbox A, Nintendo B. Game controller SDL button B. Corresponds to the right action button: Sony Circle, Xbox B, Nintendo A. Game controller SDL button X. Corresponds to the left action button: Sony Square, Xbox X, Nintendo Y. Game controller SDL button Y. Corresponds to the top action button: Sony Triangle, Xbox Y, Nintendo X. Game controller SDL back button. Corresponds to the Sony Select, Xbox Back, Nintendo - button. Game controller SDL guide button. Corresponds to the Sony PS, Xbox Home button. Game controller SDL start button. Corresponds to the Nintendo + button. Game controller SDL left stick button. Corresponds to the Sony L3, Xbox L/LS button. Game controller SDL right stick button. Corresponds to the Sony R3, Xbox R/RS button. Game controller SDL left shoulder button. Corresponds to the Sony L1, Xbox LB button. Game controller SDL right shoulder button. Corresponds to the Sony R1, Xbox RB button. Game controller D-pad up button. Game controller D-pad down button. Game controller D-pad left button. Game controller D-pad right button. Game controller SDL miscellaneous button. Corresponds to Xbox share button, PS5 microphone button, Nintendo capture button. Game controller SDL paddle 1 button. Game controller SDL paddle 2 button. Game controller SDL paddle 3 button. Game controller SDL paddle 4 button. Game controller SDL touchpad button. The number of SDL game controller buttons. The maximum number of game controller buttons supported by the engine. The actual limit may be lower on specific platforms: - Android: Up to 36 buttons. - Linux: Up to 80 buttons. - Windows and macOS: Up to 128 buttons. An invalid game controller axis. Game controller left joystick x-axis. Game controller left joystick y-axis. Game controller right joystick x-axis. Game controller right joystick y-axis. Game controller left trigger axis. Game controller right trigger axis. The number of SDL game controller axes. The maximum number of game controller axes: OpenVR supports up to 5 Joysticks making a total of 10 axes. Enum value which doesn't correspond to any MIDI message. This is used to initialize [enum MIDIMessage] properties with a generic state. MIDI note OFF message. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs. MIDI note ON message. See the documentation of [InputEventMIDI] for information of how to use MIDI inputs. MIDI aftertouch message. This message is most often sent by pressing down on the key after it "bottoms out". MIDI control change message. This message is sent when a controller value changes. Controllers include devices such as pedals and levers. MIDI program change message. This message sent when the program patch number changes. MIDI channel pressure message. This message is most often sent by pressing down on the key after it "bottoms out". This message is different from polyphonic after-touch as it indicates the highest pressure across all keys. MIDI pitch bend message. This message is sent to indicate a change in the pitch bender (wheel or lever, typically). MIDI system exclusive message. This has behavior exclusive to the device you're receiving input from. Getting this data is not implemented in Godot. MIDI quarter frame message. Contains timing information that is used to synchronize MIDI devices. Getting this data is not implemented in Godot. MIDI song position pointer message. Gives the number of 16th notes since the start of the song. Getting this data is not implemented in Godot. MIDI song select message. Specifies which sequence or song is to be played. Getting this data is not implemented in Godot. MIDI tune request message. Upon receiving a tune request, all analog synthesizers should tune their oscillators. MIDI timing clock message. Sent 24 times per quarter note when synchronization is required. MIDI start message. Start the current sequence playing. This message will be followed with Timing Clocks. MIDI continue message. Continue at the point the sequence was stopped. MIDI stop message. Stop the current sequence. MIDI active sensing message. This message is intended to be sent repeatedly to tell the receiver that a connection is alive. MIDI system reset message. Reset all receivers in the system to power-up status. It should not be sent on power-up itself. Methods that return [enum Error] return [constant OK] when no error occurred. Note that many functions don't return an error code but will print error messages to standard output. Since [constant OK] has value 0, and all other failure codes are positive integers, it can also be used in boolean checks, e.g.: [codeblock] var err = method_that_returns_error() if err != OK: print("Failure!") # Or, equivalent: if err: print("Still failing!") [/codeblock] Generic error. Unavailable error. Unconfigured error. Unauthorized error. Parameter range error. Out of memory (OOM) error. File: Not found error. File: Bad drive error. File: Bad path error. File: No permission error. File: Already in use error. File: Can't open error. File: Can't write error. File: Can't read error. File: Unrecognized error. File: Corrupt error. File: Missing dependencies error. File: End of file (EOF) error. Can't open error. Can't create error. Query failed error. Already in use error. Locked error. Timeout error. Can't connect error. Can't resolve error. Connection error. Can't acquire resource error. Can't fork process error. Invalid data error. Invalid parameter error. Already exists error. Does not exist error. Database: Read error. Database: Write error. Compilation failed error. Method not found error. Linking failed error. Script failed error. Cycling link (import cycle) error. Invalid declaration error. Duplicate symbol error. Parse error. Busy error. Skip error. Help error. Bug error. Printer on fire error. (This is an easter egg, no engine methods return this error code.) No hint for the edited property. Hints that an integer or float property should be within a range specified via the hint string [code]"min,max"[/code] or [code]"min,max,step"[/code]. The hint string can optionally include [code]"or_greater"[/code] and/or [code]"or_lesser"[/code] to allow manual input going respectively above the max or below the min values. Example: [code]"-360,360,1,or_greater,or_lesser"[/code]. Additionally, other keywords can be included: "exp" for exponential range editing, "radians" for editing radian angles in degrees, "degrees" to hint at an angle and "noslider" to hide the slider. Hints that an integer, float or string property is an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code]. Hints that a string property is can be an enumerated value to pick in a list specified via a hint string such as [code]"Hello,Something,Else"[/code]. Unlike [constant PROPERTY_HINT_ENUM] a property with this hint still accepts arbitrary values and can be empty. The list of values serves to suggest possible values. Hints that a float property should be edited via an exponential easing function. The hint string can include [code]"attenuation"[/code] to flip the curve horizontally and/or [code]"inout"[/code] to also include in/out easing. Deprecated hint, unused. Deprecated hint, unused. Hints that an integer property is a bitmask with named bit flags. For example, to allow toggling bits 0, 1, 2 and 4, the hint could be something like [code]"Bit0,Bit1,Bit2,,Bit4"[/code]. Hints that an integer property is a bitmask using the optionally named 2D render layers. Hints that an integer property is a bitmask using the optionally named 2D physics layers. Hints that an integer property is a bitmask using the optionally named 2D navigation layers. Hints that an integer property is a bitmask using the optionally named 3D render layers. Hints that an integer property is a bitmask using the optionally named 3D physics layers. Hints that an integer property is a bitmask using the optionally named 2D navigation layers. Hints that a string property is a path to a file. Editing it will show a file dialog for picking the path. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code]. Hints that a string property is a path to a directory. Editing it will show a file dialog for picking the path. Hints that a string property is an absolute path to a file outside the project folder. Editing it will show a file dialog for picking the path. The hint string can be a set of filters with wildcards like [code]"*.png,*.jpg"[/code]. Hints that a string property is an absolute path to a directory outside the project folder. Editing it will show a file dialog for picking the path. Hints that a property is an instance of a [Resource]-derived type, optionally specified via the hint string (e.g. [code]"Texture2D"[/code]). Editing it will show a popup menu of valid resource types to instantiate. Hints that a string property is text with line breaks. Editing it will show a text input field where line breaks can be typed. Hints that a string property should have a placeholder text visible on its input field, whenever the property is empty. The hint string is the placeholder text to use. Hints that a color property should be edited without changing its alpha component, i.e. only R, G and B channels are edited. Hints that an image is compressed using lossy compression. Hints that an image is compressed using lossless compression. Hint that a property represents a particular type. If a property is [constant TYPE_STRING], allows to set a type from the create dialog. If you need to create an [Array] to contain elements of a specific type, the [code]hint_string[/code] must encode nested types using [code]":"[/code] and [code]"/"[/code] for specifying [Resource] types. For instance: [codeblock] hint_string = "%s:" % [TYPE_INT] # Array of inteters. hint_string = "%s:%s:" % [TYPE_ARRAY, TYPE_REAL] # Two-dimensional array of floats. hint_string = "%s/%s:Resource" % [TYPE_OBJECT, TYPE_OBJECT] # Array of resources. hint_string = "%s:%s/%s:Resource" % [TYPE_ARRAY, TYPE_OBJECT, TYPE_OBJECT] # Two-dimensional array of resources. [/codeblock] [b]Note:[/b] The final colon is required to specify for properly detecting built-in types. Hints that a string property is a locale code. Editing it will show a locale dialog for picking language and country. The property is serialized and saved in the scene file (default). The property is shown in the editor inspector (default). Deprecated usage flag, unused. Deprecated usage flag, unused. The property can be checked in the editor inspector. The property is checked in the editor inspector. The property is a translatable string. Used to group properties together in the editor. Used to categorize properties together in the editor. Used to group properties together in the editor in a subgroup (under a group). The property does not save its state in [PackedScene]. Editing the property prompts the user for restarting the editor. The property is a script variable which should be serialized and saved in the scene file. Default usage (storage, editor and network). Default usage for translatable strings (storage, editor, network and internationalized). Default usage but without showing the property in the editor (storage, network). Flag for a normal method. Flag for an editor method. Deprecated method flag, unused. Flag for a constant method. Deprecated method flag, unused. Flag for a virtual method. Deprecated method flag, unused. Used internally. Allows to not dump core virtuals such as [code]_notification[/code] to the JSON API. Default method flags. Used with [method Node.rpc_config] to disable a method or property for all RPC calls, making it unavailable. Default for all methods. Used with [method Node.rpc_config] to set a method to be callable remotely by any peer. Analogous to the [code]@rpc(any)[/code] annotation. Calls are accepted from all remote peers, no matter if they are node's authority or not. Used with [method Node.rpc_config] to set a method to be callable remotely only by the current multiplayer authority (which is the server by default). Analogous to the [code]@rpc(auth)[/code] annotation. See [method Node.set_multiplayer_authority]. Packets are not acknowledged, no resend attempts are made for lost packets. Packets may arrive in any order. Potentially faster than [constant TRANSFER_MODE_UNRELIABLE_ORDERED]. Use for non-critical data, and always consider whether the order matters. Packets are not acknowledged, no resend attempts are made for lost packets. Packets are received in the order they were sent in. Potentially faster than [constant TRANSFER_MODE_RELIABLE]. Use for non-critical data or data that would be outdated if received late due to resend attempt(s) anyway, for example movement and positional data. Packets must be received and resend attempts should be made until the packets are acknowledged. Packets must be received in the order they were sent in. Most reliable transfer mode, but potentially the slowest due to the overhead. Use for critical data that must be transmitted and arrive in order, for example an ability being triggered or a chat message. Consider carefully if the information really is critical, and use sparingly. Variable is [code]null[/code]. Variable is of type [bool]. Variable is of type [int]. Variable is of type [float] (real). Variable is of type [String]. Variable is of type [Vector2]. Variable is of type [Vector2i]. Variable is of type [Rect2]. Variable is of type [Rect2i]. Variable is of type [Vector3]. Variable is of type [Vector3i]. Variable is of type [Transform2D]. Variable is of type [Plane]. Variable is of type [Quaternion]. Variable is of type [AABB]. Variable is of type [Basis]. Variable is of type [Transform3D]. Variable is of type [Color]. Variable is of type [StringName]. Variable is of type [NodePath]. Variable is of type [RID]. Variable is of type [Object]. Variable is of type [Callable]. Variable is of type [Signal]. Variable is of type [Dictionary]. Variable is of type [Array]. Variable is of type [PackedByteArray]. Variable is of type [PackedInt32Array]. Variable is of type [PackedInt64Array]. Variable is of type [PackedFloat32Array]. Variable is of type [PackedFloat64Array]. Variable is of type [PackedStringArray]. Variable is of type [PackedVector2Array]. Variable is of type [PackedVector3Array]. Variable is of type [PackedColorArray]. Represents the size of the [enum Variant.Type] enum. Equality operator ([code]==[/code]). Inequality operator ([code]!=[/code]). Less than operator ([code]<[/code]). Less than or equal operator ([code]<=[/code]). Greater than operator ([code]>[/code]). Greater than or equal operator ([code]>=[/code]). Addition operator ([code]+[/code]). Subtraction operator ([code]-[/code]). Multiplication operator ([code]*[/code]). Division operator ([code]/[/code]). Unary negation operator ([code]-[/code]). Unary plus operator ([code]+[/code]). Remainder/modulo operator ([code]%[/code]). Left shift operator ([code]<<[/code]). Right shift operator ([code]>>[/code]). Bitwise AND operator ([code]&[/code]). Bitwise OR operator ([code]|[/code]). Bitwise XOR operator ([code]^[/code]). Bitwise NOT operator ([code]~[/code]). Logical AND operator ([code]and[/code] or [code]&&[/code]). Logical OR operator ([code]or[/code] or [code]||[/code]). Logical XOR operator (not implemented in GDScript). Logical NOT operator ([code]not[/code] or [code]![/code]). Logical IN operator ([code]in[/code]). Represents the size of the [enum Variant.Operator] enum.