class_@gdscript - dragonsoulz/godot GitHub Wiki
@GDScript
####Category: Core
Brief Description
Built-in GDScript functions.
Member Functions
- float sin ( float s )
- float cos ( float s )
- float tan ( float s )
- float sinh ( float s )
- float cosh ( float s )
- float tanh ( float s )
- float asin ( float s )
- float acos ( float s )
- float atan ( float s )
- float atan2 ( float x, float y )
- float sqrt ( float s )
- float fmod ( float x, float y )
- float fposmod ( float x, float y )
- float floor ( float s )
- float ceil ( float s )
- float round ( float s )
- float abs ( float s )
- float sign ( float s )
- float pow ( float x, float y )
- float log ( float s )
- float exp ( float s )
- float isnan ( float s )
- float isinf ( float s )
- float ease ( float s, float curve )
- float decimals ( float step )
- float stepify ( float s, float step )
- float lerp ( float a, float b, float c )
- float dectime ( float value, float amount, float step )
- Nil randomize ( )
- int randi ( )
- float randf ( )
- float rand_range ( float from, float to )
- Array rand_seed ( float seed )
- float deg2rad ( float deg )
- float rad2deg ( float rad )
- float linear2db ( float nrg )
- float db2linear ( float db )
- float max ( float a, float b )
- float min ( float a, float b )
- float clamp ( float val, float min, float max )
- int nearest_po2 ( int val )
- Object weakref ( Object obj )
- Object funcref ( Object instance, String funcname )
- Object convert ( var what, int type )
- String str ( var what, var ... )
- String str ( var what, var ... )
- Nil print ( var what, var ... )
- Nil printt ( var what, var ... )
- Nil printerr ( var what, var ... )
- Nil printraw ( var what, var ... )
- Array range ( var ... )
- Object load ( String path )
- Dictionary inst2dict ( Object inst )
- Object dict2inst ( Dictionary dict )
- int hash ( var var:var )
- Nil print_stack ( )
Numeric Constants
- PI = 3.141593 - Constant that represents how many times the diameter of a circumference fits around it's perimeter.
Description
This contains the list of built-in gdscript functions. Mostly math functions and other utilities. Everything else is expanded by objects.
Member Function Description
sin
Standard sine function.
cos
Standard cosine function.
tan
Standard tangent function.
sinh
Hyperbolic sine.
cosh
Hyperbolic cosine.
tanh
Hyperbolic tangent.
asin
Arc-sine.
acos
Arc-cosine.
atan
Arc-tangent.
atan2
Arc-tangent that takes a 2D vector as argument, retuns the full -pi to +pi range.
sqrt
Square root.
fmod
Module (remainder of x/y).
fposmod
Module (remainder of x/y) that wraps equally in positive and negative.
floor
Floor (rounds down to nearest integer).
ceil
Ceiling (rounds up to nearest integer).
round
Round to nearest integer.
abs
Remove sign (works for integer and float).
sign
Return sign (-1 or +1).
pow
Power function, x elevate to y.
log
Natural logarithm.
exp
Exponential logarithm.
isnan
Return true if the float is not a number.
isinf
Return true if the float is infinite.
ease
Easing function, based on exponent. 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in.
decimals
Return the amount of decimals in the floating point value.
stepify
Snap float value to a given step.
randomize
- Nil randomize ( )
Reset the seed of the random number generator with a new, different one.
randi
- int randi ( )
Random 32 bits value (integer). To obtain a value from 0 to N, you can use remainder, like (for random from 0 to 19): randi() % 20.
randf
- float randf ( )
Random value (0 to 1 float).
rand_range
Random range, any floating point value between 'from' and 'to'
rand_seed
Random from seed, pass a seed and an array with both number and new seed is returned.
deg2rad
Convert from degrees to radians.
rad2deg
Convert from radias to degrees.
linear2db
Convert from linear energy to decibels (audio).
db2linear
Convert from decibels to linear energy (audio).
max
Return the maximum of two values.
min
Return the minimum of two values.
clamp
Clamp both values to a range.
nearest_po2
Return the nearest larger power of 2 for an integer.
weakref
Return a weak reference to an object.
convert
Convert from a type to another in the best way possible. The "type" parameter uses the enum TYPE_* in Global Scope.
str
- String str ( var what, var ... )
Convert one or more arguments to strings in the best way possible.
str
- String str ( var what, var ... )
Convert one or more arguments to strings in the best way possible.
- Nil print ( var what, var ... )
Print one or more arguments to strings in the best way possible to a console line.
printerr
- Nil printerr ( var what, var ... )
Print one or more arguments to strings in the best way possible to standard error line.
printraw
- Nil printraw ( var what, var ... )
Print one or more arguments to strings in the best way possible to console. No newline is added at the end.
range
- Array range ( var ... )
Return an array with the given range. Range can be 1 argument N (0 to N-1), two arguments (initial, final-1) or three arguments (initial,final-1,increment).
load
Load a resource from the filesystem, pass a valid path as argument.
inst2dict
- Dictionary inst2dict ( Object inst )
Convert a script class instance to a dictionary (useful for serializing).
dict2inst
- Object dict2inst ( Dictionary dict )
Convert a previously converted instances to dictionary back into an instance. Useful for deserializing.
print_stack
- Nil print_stack ( )
Print a stack track at code location, only works when running with debugger turned on.