List of core built-in GDScript functions. Math functions and other utilities. Everything else is provided by objects. (Keywords: builtin, built in, global functions.)
List of core built-in GDScript functions. Math functions and other utilities. Everything else is provided by objects. (Keywords: builtin, built in, global functions.)
-- **PI** = **3.141593** --- Constant that represents how many times the diameter of a circle fits around its perimeter.
+- **PI** = **3.14159265358979** --- Constant that represents how many times the diameter of a circle fits around its perimeter. This is equivalent to ``TAU / 2``, or 180 degrees in rotations.
+
+- **TAU** = **6.28318530717959** --- The circle constant, the circumference of the unit circle in radians. This is equivalent to ``PI * 2``, or 360 degrees in rotations.
-- **TAU** = **6.283185** --- The circle constant, the circumference of the unit circle.
+- **INF** = **inf** --- Positive floating-point infinity. This is the result of floating-point division when the divisor is ``0.0``. For negative infinity, use ``-INF``. Dividing by ``-0.0`` will result in negative infinity if the numerator is positive, so dividing by ``0.0`` is not the same as dividing by ``-0.0`` (despite ``0.0 == -0.0`` returning ``true``).
-- **INF** = **inf** --- A positive infinity. (For negative infinity, use -INF).
+**Note:** Numeric infinity is only a concept with floating-point numbers, and has no equivalent for integers. Dividing an integer number by ``0`` will not result in :ref:`INF<class_@GDScript_constant_INF>` and will result in a run-time error instead.
-- **NAN** = **nan** --- Macro constant that expands to an expression of type float that represents a NaN.
+- **NAN** = **nan** --- "Not a Number", an invalid floating-point value. :ref:`NAN<class_@GDScript_constant_NAN>` has special properties, including that it is not equal to itself (``NAN == NAN`` returns ``false``). It is output by some invalid operations, such as dividing floating-point ``0.0`` by ``0.0``.
-The NaN values are used to identify undefined or non-representable values for floating-point elements, such as the square root of negative numbers or the result of 0/0.
+**Note:** "Not a Number" is only a concept with floating-point numbers, and has no equivalent for integers. Dividing an integer ``0`` by ``0`` will not result in :ref:`NAN<class_@GDScript_constant_NAN>` and will result in a run-time error instead.
Method Descriptions
Method Descriptions
-------------------
-------------------
@@ -249,135 +102,30 @@ Returns a color constructed from integer red, green, blue, and alpha channels. E
+Asserts that the ``condition`` is ``true``. If the ``condition`` is ``false``, an error is generated. When running from the editor, the running project will also be paused until you resume it. This can be used as a stronger form of :ref:`@GlobalScope.push_error<class_@GlobalScope_method_push_error>` for reporting errors to project developers or add-on users.
+**Note:** For performance reasons, the code inside :ref:`assert<class_@GDScript_method_assert>` is only executed in debug builds or when running the project from the editor. Don't include code that has side effects in an :ref:`assert<class_@GDScript_method_assert>` call. Otherwise, the project will behave differently when exported in release mode.
-Asserts that the ``condition`` is ``true`` . If the ``condition`` is ``false``, an error is generated and the program is halted until you resume it. Only executes in debug builds, or when running the game from the editor. Use it for debugging purposes, to make sure a statement is ``true`` during development.
+The optional ``message`` argument, if given, is shown in addition to the generic "Assertion failed" message. You can use this to provide additional details about why the assertion failed.
::
::
- # Imagine we always want speed to be between 0 and 20
- speed = -10
+ # Imagine we always want speed to be between 0 and 20.
+ var speed = -10
assert(speed < 20) # True, the program will continue
assert(speed < 20) # True, the program will continue
assert(speed >= 0) # False, the program will stop
assert(speed >= 0) # False, the program will stop
- assert(speed >= 0 && speed < 20) # You can also combine the two conditional statements in one check
-
-----
-
-.. _class_@GDScript_method_atan:
-
-- :ref:`float<class_float>` **atan** **(** :ref:`float<class_float>` s **)**
-
-Returns the arc tangent of ``s`` in radians. Use it to get the angle from an angle's tangent in trigonometry: ``atan(tan(angle)) == angle``.
-
-The method cannot know in which quadrant the angle should fall. See :ref:`atan2<class_@GDScript_method_atan2>` if you always want an exact angle.
-
-::
-
- a = atan(0.5) # a is 0.463648
-
-----
-
-.. _class_@GDScript_method_atan2:
-
-- :ref:`float<class_float>` **atan2** **(** :ref:`float<class_float>` y, :ref:`float<class_float>` x **)**
-
-Returns the arc tangent of ``y/x`` in radians. Use to get the angle of tangent ``y/x``. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant.
-Decodes a byte array back to a value. When ``allow_objects`` is ``true`` decoding objects is allowed.
-
-**WARNING:** 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).
-
-----
-
-.. _class_@GDScript_method_cartesian2polar:
-
-- :ref:`Vector2<class_Vector2>` **cartesian2polar** **(** :ref:`float<class_float>` x, :ref:`float<class_float>` y **)**
-
-Converts a 2D point expressed in the cartesian coordinate system (X and Y axis) to the polar coordinate system (a distance from the origin and an angle).
-
-----
-
-.. _class_@GDScript_method_ceil:
-
-- :ref:`float<class_float>` **ceil** **(** :ref:`float<class_float>` s **)**
-
-Rounds ``s`` upward, returning the smallest integral value that is not less than ``s``.
-
-::
-
- i = ceil(1.45) # i is 2
- i = ceil(1.001) # i is 2
+ assert(speed >= 0 and speed < 20) # You can also combine the two conditional statements in one check
+ assert(speed < 20, "speed = %f, but the speed limit is 20" % speed) # Show a message with clarifying details
-Returns a reference to the specified function ``funcname`` in the ``instance`` node. As functions aren't first-class objects in GDscript, use ``funcref`` to store a :ref:`FuncRef<class_FuncRef>` in a variable and call it later.
-
-::
-
- func foo():
- return("bar")
-
- a = funcref(self, "foo")
- print(a.call_func()) # Prints bar
+Converts a dictionary (previously created with :ref:`inst2dict<class_@GDScript_method_inst2dict>`) back to an instance. Useful for deserializing.
----
----
@@ -623,21 +187,9 @@ would print
----
----
-.. _class_@GDScript_method_hash:
-
-- :ref:`int<class_int>` **hash** **(** :ref:`Variant<class_Variant>` var **)**
-- :ref:`bool<class_bool>` **is_inf** **(** :ref:`float<class_float>` s **)**
+Loads a resource from the filesystem located at ``path``. The resource is loaded on the method call (unless it's referenced already elsewhere, e.g. in another script or in the scene), which might cause slight delay, especially when loading scenes. To avoid unnecessary delays when loading something multiple times, either store the resource in a variable or use :ref:`preload<class_@GDScript_method_preload>`.
-Returns whether ``s`` is an infinity value (either positive infinity or negative infinity).
+**Note:** Resource paths can be obtained by right-clicking on a resource in the FileSystem dock and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script.
-----
+::
-.. _class_@GDScript_method_is_instance_valid:
+ # Load a scene called main located in the root of the project directory and cache it in a variable.
+ var main = load("res://main.tscn") # main will contain a PackedScene resource.
+Returns a :ref:`Resource<class_Resource>` from the filesystem located at ``path``. The resource is loaded during script parsing, i.e. is loaded with the script and :ref:`preload<class_@GDScript_method_preload>` effectively acts as a reference to that resource. Note that the method requires a constant path. If you want to load a resource from a dynamic/variable path, use :ref:`load<class_@GDScript_method_load>`.
-.. _class_@GDScript_method_is_zero_approx:
+**Note:** Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path" or by dragging the file from the FileSystem dock into the script.
-- :ref:`bool<class_bool>` **is_zero_approx** **(** :ref:`float<class_float>` s **)**
+::
-Returns ``true`` if ``s`` is zero or almost zero.
+ # Instance a scene.
+ var diamond = preload("res://diamond.tscn").instantiate()
----
----
-.. _class_@GDScript_method_len:
-
-- :ref:`int<class_int>` **len** **(** :ref:`Variant<class_Variant>` var **)**
-
-Returns length of Variant ``var``. Length is the character count of String, element count of Array, size of Dictionary, etc.
-
-**Note:** Generates a fatal error if Variant can not provide a length.
+.. _class_@GDScript_method_print_debug:
-::
+- void **print_debug** **(** ... **)** |vararg|
- a = [1, 2, 3, 4]
- len(a) # Returns 4
+Like :ref:`@GlobalScope.print<class_@GlobalScope_method_print>`, but prints only when used in debug mode.
-Linearly interpolates between two values by a normalized value. This is the opposite of :ref:`inverse_lerp<class_@GDScript_method_inverse_lerp>`.
+- void **print_stack** **(** **)**
-If the ``from`` and ``to`` arguments are of type :ref:`int<class_int>` or :ref:`float<class_float>`, the return value is a :ref:`float<class_float>`.
+Prints a stack track at code location, only works when running with debugger turned on.
-If both are of the same vector type (:ref:`Vector2<class_Vector2>`, :ref:`Vector3<class_Vector3>` or :ref:`Color<class_Color>`), the return value will be of the same type (``lerp`` then calls the vector type's ``linear_interpolate`` method).
+Output in the console would look something like this:
-Linearly interpolates between two angles (in radians) by a normalized value.
+Returns 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``). Returns an empty array if the range isn't valid (e.g. ``range(2, 5, -1)`` or ``range(5, 5, 1)``).
-Similar to :ref:`lerp<class_@GDScript_method_lerp>`, but interpolates correctly when the angles wrap around :ref:`TAU<class_@GDScript_constant_TAU>`.
+Returns an array with the given range. ``range()`` can have 1 argument N (``0`` to ``N - 1``), two arguments (``initial``, ``final - 1``) or three arguments (``initial``, ``final - 1``, ``increment``). ``increment`` can be negative. If ``increment`` is negative, ``final - 1`` will become ``final + 1``. Also, the initial value must be greater than the final value for the loop to run.
-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:
+Output:
::
::
- # "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.
-Parse JSON text to a Variant (use :ref:`typeof<class_@GDScript_method_typeof>` to check if it is what you expect).
-
-Be aware that the JSON specification does not define integer or float types, but only a number type. Therefore, parsing a JSON text will convert all numerical values to :ref:`float<class_float>` types.
-
-Note that JSON objects do not preserve key order like Godot dictionaries, thus you should not rely on keys being in a certain order if a dictionary is constructed from JSON. In contrast, JSON arrays retain the order of their elements:
-Converts a 2D point expressed in the polar coordinate system (a distance from the origin ``r`` and an angle ``th``) to the cartesian coordinate system (X and Y axis).
-
-----
-
-.. _class_@GDScript_method_posmod:
-
-- :ref:`int<class_int>` **posmod** **(** :ref:`int<class_int>` a, :ref:`int<class_int>` b **)**
-
-Returns the integer modulus of ``a/b`` that wraps equally in positive and negative.
-Returns a resource from the filesystem that is loaded during script parsing.
-
-**Note:** Resource paths can be obtained by right clicking on a resource in the Assets Panel and choosing "Copy Path".
-
-::
-
- # Load a scene called main located in the root of the project directory.
- var main = preload("res://main.tscn")
-
-----
-
-.. _class_@GDScript_method_print:
-
-- void **print** **(** ... **)** vararg
-
-Converts one or more arguments to strings in the best way possible and prints them to the console.
-
-::
-
- a = [1, 2, 3]
- print("a", "b", a) # Prints ab[1, 2, 3]
-
-----
-
-.. _class_@GDScript_method_print_debug:
-
-- void **print_debug** **(** ... **)** vararg
-
-Like :ref:`print<class_@GDScript_method_print>`, but prints only when used in debug mode.
-
-----
-
-.. _class_@GDScript_method_print_stack:
-
-- void **print_stack** **(** **)**
-
-Prints a stack track at code location, only works when running with debugger turned on.
-
-Output in the console would look something like this:
-
-::
-
- Frame 0 - res://test.gd:16 in function '_process'
-
-----
-
-.. _class_@GDScript_method_printerr:
-
-- void **printerr** **(** ... **)** vararg
-
-Prints one or more arguments to strings in the best way possible to standard error line.
-
-::
-
- printerr("prints to stderr")
-
-----
-
-.. _class_@GDScript_method_printraw:
-
-- void **printraw** **(** ... **)** vararg
-
-Prints one or more arguments to strings in the best way possible to console. No newline is added at the end.
-
-::
-
- printraw("A")
- printraw("B")
- # Prints AB
-
-**Note:** 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 :ref:`print<class_@GDScript_method_print>`.
-
-----
-
-.. _class_@GDScript_method_prints:
-
-- void **prints** **(** ... **)** vararg
-
-Prints one or more arguments to the console with a space between each argument.
-
-::
-
- prints("A", "B", "C") # Prints A B C
-
-----
-
-.. _class_@GDScript_method_printt:
-
-- void **printt** **(** ... **)** vararg
-
-Prints one or more arguments to the console with a tab between each argument.
-Random from seed: pass a ``seed``, 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 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).
-Returns a number smoothly interpolated between the ``from`` and ``to``, based on the ``weight``. Similar to :ref:`lerp<class_@GDScript_method_lerp>`, but interpolates faster at the beginning and slower at the end.
-
-::
-
- smoothstep(0, 2, 0.5) # Returns 0.15
- smoothstep(0, 2, 1.0) # Returns 0.5
- smoothstep(0, 2, 2.0) # Returns 1.0
-
-----
-
-.. _class_@GDScript_method_sqrt:
-
-- :ref:`float<class_float>` **sqrt** **(** :ref:`float<class_float>` s **)**
-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.
-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 ``value`` between ``min`` and ``max``.
-
-Usable for creating loop-alike behavior or infinite surfaces.
-
-::
-
- # a is 0.5
- a = wrapf(10.5, 0.0, 10.0)
-
-::
-
- # a is 9.5
- a = wrapf(-0.5, 0.0, 10.0)
-
-::
-
- # Infinite loop between 0.0 and 0.99
- f = wrapf(f + 0.1, 0.0, 1.0)
-
-::
-
- # Infinite rotation (in radians)
- angle = wrapf(angle + 0.1, 0.0, TAU)
-
-**Note:** If you just want to wrap between 0.0 and ``n`` (where ``n`` is a positive floating-point value), it is better for performance to use the :ref:`fmod<class_@GDScript_method_fmod>` method like ``fmod(number, n)``.
-
-``wrapf`` is more flexible than using the :ref:`fmod<class_@GDScript_method_fmod>` approach by giving the user a simple control over the minimum value. It also fully supports negative numbers, e.g.
-Wraps integer ``value`` between ``min`` and ``max``.
-
-Usable for creating loop-alike behavior or infinite surfaces.
-
-::
-
- # a is 0
- a = wrapi(10, 0, 10)
-
-::
-
- # a is 9
- a = wrapi(-1, 0, 10)
-
-::
-
- # Infinite loop between 0 and 9
- frame = wrapi(frame + 1, 0, 10)
-
-**Note:** If you just want to wrap between 0 and ``n`` (where ``n`` is a positive integer value), it is better for performance to use the modulo operator like ``number % n``.
-
-``wrapi`` is more flexible than using the modulo approach by giving the user a simple control over the minimum value. It also fully supports negative numbers, e.g.
-Stops the function execution and returns the current suspended state to the calling function.
-
-From the caller, call :ref:`GDScriptFunctionState.resume<class_GDScriptFunctionState_method_resume>` on the state to resume execution. This invalidates the state. Within the resumed function, ``yield()`` returns whatever was passed to the ``resume()`` function call.
-
-If passed an object and a signal, the execution is resumed when the object emits the given signal. In this case, ``yield()`` returns the argument passed to ``emit_signal()`` if the signal takes only one argument, or an array containing all the arguments passed to ``emit_signal()`` if the signal takes multiple arguments.
-
-You can also use ``yield`` to wait for a function to finish:
-
-::
-
- func _ready():
- yield(countdown(), "completed") # waiting for the countdown() function to complete
- print('Ready')
-
- func countdown():
- yield(get_tree(), "idle_frame") # returns a GDScriptFunctionState object to _ready()
- print(3)
- yield(get_tree().create_timer(1.0), "timeout")
- print(2)
- yield(get_tree().create_timer(1.0), "timeout")
- print(1)
- yield(get_tree().create_timer(1.0), "timeout")
-
- # prints:
- # 3
- # 2
- # 1
- # Ready
-
-When yielding on a function, the ``completed`` signal will be emitted automatically when the function returns. It can, therefore, be used as the ``signal`` parameter of the ``yield`` method to resume.
-
-In order to yield on a function, the resulting function should also return a ``GDScriptFunctionState``. Notice ``yield(get_tree(), "idle_frame")`` from the above example.
+- :ref:`bool<class_bool>` **type_exists** **(** :ref:`StringName<class_StringName>` type **)**
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
-.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
-.. DO NOT EDIT THIS FILE, but the @VisualScript.xml source instead.
-.. The source is found in doc/classes or modules/<name>/doc_classes.
-
-.. _class_@VisualScript:
-
-@VisualScript
-=============
-
-Built-in visual script functions.
-
-Description
------------
-
-A list of built-in visual script functions, see :ref:`VisualScriptBuiltinFunc<class_VisualScriptBuiltinFunc>` and :ref:`VisualScript<class_VisualScript>`.
+Constructs a default-initialized ``AABB`` with default (zero) values of :ref:`position<class_AABB_property_position>` and :ref:`size<class_AABB_property_size>`.
-Optional constructor, accepts position and size.
+----
+
+- :ref:`AABB<class_AABB>` **AABB** **(** :ref:`AABB<class_AABB>` from **)** |constructor|
+
+Constructs an ``AABB`` as a copy of the given ``AABB``.
-Returns ``true`` if this ``AABB`` and ``aabb`` are approximately equal, by calling :ref:`@GDScript.is_equal_approx<class_@GDScript_method_is_equal_approx>` on each component.
+Returns ``true`` if this ``AABB`` and ``aabb`` are approximately equal, by calling :ref:`@GlobalScope.is_equal_approx<class_@GlobalScope_method_is_equal_approx>` on each component.
----
----
.. _class_AABB_method_merge:
.. _class_AABB_method_merge:
-- :ref:`AABB<class_AABB>` **merge** **(** :ref:`AABB<class_AABB>` with **)**
+- :ref:`AABB<class_AABB>` **merge** **(** :ref:`AABB<class_AABB>` with **)** |const|
Returns a larger ``AABB`` that contains both this ``AABB`` and ``with``.
Returns a larger ``AABB`` that contains both this ``AABB`` and ``with``.
+Removes the ``button`` from the dialog. Does NOT free the ``button``. The ``button`` must be a :ref:`Button<class_Button>` added with :ref:`add_button<class_AcceptDialog_method_add_button>` or :ref:`add_cancel_button<class_AcceptDialog_method_add_cancel_button>` method. After removal, pressing the ``button`` will no longer emit this dialog's :ref:`custom_action<class_AcceptDialog_signal_custom_action>` or :ref:`cancelled<class_AcceptDialog_signal_cancelled>` signals.
+
+Theme Property Descriptions
+---------------------------
+
+.. _class_AcceptDialog_theme_style_panel:
+
+- :ref:`StyleBox<class_StyleBox>` **panel**
+
+Panel that fills up the background of the window.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+Get the current IV state for this context (IV gets updated when calling :ref:`update<class_AESContext_method_update>`). You normally don't need this function.
+
+**Note:** This function only makes sense when the context is started with :ref:`MODE_CBC_ENCRYPT<class_AESContext_constant_MODE_CBC_ENCRYPT>` or :ref:`MODE_CBC_DECRYPT<class_AESContext_constant_MODE_CBC_DECRYPT>`.
+Start the AES context in the given ``mode``. A ``key`` of either 16 or 32 bytes must always be provided, while an ``iv`` (initialization vector) of exactly 16 bytes, is only needed when ``mode`` is either :ref:`MODE_CBC_ENCRYPT<class_AESContext_constant_MODE_CBC_ENCRYPT>` or :ref:`MODE_CBC_DECRYPT<class_AESContext_constant_MODE_CBC_DECRYPT>`.
+Run the desired operation for this AES context. Will return a :ref:`PackedByteArray<class_PackedByteArray>` containing the result of encrypting (or decrypting) the given ``src``. See :ref:`start<class_AESContext_method_start>` for mode of operation.
+
+**Note:** The size of ``src`` must be a multiple of 16. Apply some padding if needed.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+Physics body for 2D physics which moves only by script or animation. Useful for moving platforms and doors.
+
+Description
+-----------
+
+Animatable body for 2D physics.
+
+An animatable body can't be moved by external forces or contacts, but can be moved by script or animation to affect other bodies in its path. It is ideal for implementing moving objects in the environment, such as moving platforms or doors.
+
+When the body is moved manually, either from code or from an :ref:`AnimationPlayer<class_AnimationPlayer>` (with :ref:`AnimationPlayer.playback_process_mode<class_AnimationPlayer_property_playback_process_mode>` set to ``physics``), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
+If ``true``, the body's movement will be synchronized to the physics frame. This is useful when animating movement via :ref:`AnimationPlayer<class_AnimationPlayer>`, for example on moving platforms. Do **not** use together with :ref:`PhysicsBody2D.move_and_collide<class_PhysicsBody2D_method_move_and_collide>`.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+Physics body for 3D physics which moves only by script or animation. Useful for moving platforms and doors.
+
+Description
+-----------
+
+Animatable body for 3D physics.
+
+An animatable body can't be moved by external forces or contacts, but can be moved by script or animation to affect other bodies in its path. It is ideal for implementing moving objects in the environment, such as moving platforms or doors.
+
+When the body is moved manually, either from code or from an :ref:`AnimationPlayer<class_AnimationPlayer>` (with :ref:`AnimationPlayer.playback_process_mode<class_AnimationPlayer_property_playback_process_mode>` set to ``physics``), the physics will automatically compute an estimate of their linear and angular velocity. This makes them very useful for moving platforms or other AnimationPlayer-controlled objects (like a door, a bridge that opens, etc).
+If ``true``, the body's movement will be synchronized to the physics frame. This is useful when animating movement via :ref:`AnimationPlayer<class_AnimationPlayer>`, for example on moving platforms. Do **not** use together with :ref:`PhysicsBody3D.move_and_collide<class_PhysicsBody3D_method_move_and_collide>`.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Animations are created using a :ref:`SpriteFrames<class_SpriteFrames>` resource, which can be configured in the editor via the SpriteFrames panel.
Animations are created using a :ref:`SpriteFrames<class_SpriteFrames>` resource, which can be configured in the editor via the SpriteFrames panel.
+**Note:** You can associate a set of normal or specular maps by creating additional :ref:`SpriteFrames<class_SpriteFrames>` resources with a ``_normal`` or ``_specular`` suffix. For example, having 3 :ref:`SpriteFrames<class_SpriteFrames>` resources ``run``, ``run_normal``, and ``run_specular`` will make it so the ``run`` animation uses normal and specular maps.
+
+Tutorials
+---------
+
+- :doc:`../tutorials/2d/2d_sprite_animation`
+
+- `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
Plays the animation named ``anim``. If no ``anim`` is provided, the current animation is played. If ``backwards`` is ``true``, the animation will be played in reverse.
Plays the animation named ``anim``. If no ``anim`` is provided, the current animation is played. If ``backwards`` is ``true``, the animation will be played in reverse.
----
----
-.. _class_AnimatedSprite_method_stop:
+.. _class_AnimatedSprite2D_method_stop:
- void **stop** **(** **)**
- void **stop** **(** **)**
Stops the current animation (does not reset the frame counter).
Stops the current animation (does not reset the frame counter).
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+Emitted when the animation is finished (when it plays the last frame). If the animation is looping, this signal is emitted every time the last frame is drawn.
-``AnimatedTexture`` is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike :ref:`AnimationPlayer<class_AnimationPlayer>` or :ref:`AnimatedSprite<class_AnimatedSprite>`, it isn't a :ref:`Node<class_Node>`, but has the advantage of being usable anywhere a :ref:`Texture2D<class_Texture2D>` resource can be used, e.g. in a :ref:`TileSet<class_TileSet>`.
+``AnimatedTexture`` is a resource format for frame-based animations, where multiple textures can be chained automatically with a predefined delay for each frame. Unlike :ref:`AnimationPlayer<class_AnimationPlayer>` or :ref:`AnimatedSprite2D<class_AnimatedSprite2D>`, it isn't a :ref:`Node<class_Node>`, but has the advantage of being usable anywhere a :ref:`Texture2D<class_Texture2D>` resource can be used, e.g. in a :ref:`TileSet<class_TileSet>`.
The playback of the animation is controlled by the :ref:`fps<class_AnimatedTexture_property_fps>` property as well as each frame's optional delay (see :ref:`set_frame_delay<class_AnimatedTexture_method_set_frame_delay>`). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.
The playback of the animation is controlled by the :ref:`fps<class_AnimatedTexture_property_fps>` property as well as each frame's optional delay (see :ref:`set_frame_delay<class_AnimatedTexture_method_set_frame_delay>`). The animation loops, i.e. it will restart at frame 0 automatically after playing the last frame.
-``AnimatedTexture`` currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one. Also, it doesn't support :ref:`AtlasTexture<class_AtlasTexture>`. Each frame needs to be separate image.
+``AnimatedTexture`` currently requires all frame textures to have the same size, otherwise the bigger ones will be cropped to match the smallest one.
+
+**Note:** AnimatedTexture doesn't support using :ref:`AtlasTexture<class_AtlasTexture>`\ s. Each frame needs to be a separate :ref:`Texture2D<class_Texture2D>`.
-- **MAX_FRAMES** = **256** --- The maximum number of frames supported by ``AnimatedTexture``. If you need more frames in your animation, use :ref:`AnimationPlayer<class_AnimationPlayer>` or :ref:`AnimatedSprite<class_AnimatedSprite>`.
+- **MAX_FRAMES** = **256** --- The maximum number of frames supported by ``AnimatedTexture``. If you need more frames in your animation, use :ref:`AnimationPlayer<class_AnimationPlayer>` or :ref:`AnimatedSprite2D<class_AnimatedSprite2D>`.
@@ -86,12 +108,44 @@ For example, an animation with 8 frames, no frame delay and a ``fps`` value of 2
Number of frames to use in the animation. While you can create the frames independently with :ref:`set_frame_texture<class_AnimatedTexture_method_set_frame_texture>`, you need to set this value for the animation to take new frames into account. The maximum number of frames is :ref:`MAX_FRAMES<class_AnimatedTexture_constant_MAX_FRAMES>`.
Number of frames to use in the animation. While you can create the frames independently with :ref:`set_frame_texture<class_AnimatedTexture_method_set_frame_texture>`, you need to set this value for the animation to take new frames into account. The maximum number of frames is :ref:`MAX_FRAMES<class_AnimatedTexture_constant_MAX_FRAMES>`.
+----
+
+.. _class_AnimatedTexture_property_oneshot:
+
+- :ref:`bool<class_bool>` **oneshot**
+
++-----------+--------------------+
+| *Default* | ``false`` |
++-----------+--------------------+
+| *Setter* | set_oneshot(value) |
++-----------+--------------------+
+| *Getter* | get_oneshot() |
++-----------+--------------------+
+
+If ``true``, the animation will only play once and will not loop back to the first frame after reaching the end. Note that reaching the end will not set :ref:`pause<class_AnimatedTexture_property_pause>` to ``true``.
+
+----
+
+.. _class_AnimatedTexture_property_pause:
+
+- :ref:`bool<class_bool>` **pause**
+
++-----------+------------------+
+| *Default* | ``false`` |
++-----------+------------------+
+| *Setter* | set_pause(value) |
++-----------+------------------+
+| *Getter* | get_pause() |
++-----------+------------------+
+
+If ``true``, the animation will pause where it currently is (i.e. at :ref:`current_frame<class_AnimatedTexture_property_current_frame>`). The animation will continue from where it was paused when changing this property to ``false``.
Returns the given frame's :ref:`Texture2D<class_Texture2D>`.
Returns the given frame's :ref:`Texture2D<class_Texture2D>`.
@@ -130,3 +184,9 @@ Assigns a :ref:`Texture2D<class_Texture2D>` to the given frame. Frame IDs start
You can define any number of textures up to :ref:`MAX_FRAMES<class_AnimatedTexture_constant_MAX_FRAMES>`, but keep in mind that only frames from 0 to :ref:`frames<class_AnimatedTexture_property_frames>` - 1 will be part of the animation.
You can define any number of textures up to :ref:`MAX_FRAMES<class_AnimatedTexture_constant_MAX_FRAMES>`, but keep in mind that only frames from 0 to :ref:`frames<class_AnimatedTexture_property_frames>` - 1 will be part of the animation.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Contains data used to animate everything in the engine.
Contains data used to animate everything in the engine.
@@ -18,16 +18,31 @@ Description
An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track.
An Animation resource contains data used to animate everything in the engine. Animations are divided into tracks, and each track must be linked to a node. The state of that node can be changed through time, by adding timed keys (events) to the track.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
# This creates an animation that makes the node "Enemy" move to the right by
# This creates an animation that makes the node "Enemy" move to the right by
- # 100 pixels in 1 second.
+ # 100 pixels in 0.5 seconds.
var animation = Animation.new()
var animation = Animation.new()
var track_index = animation.add_track(Animation.TYPE_VALUE)
var track_index = animation.add_track(Animation.TYPE_VALUE)
Animations are just data containers, and must be added to nodes such as an :ref:`AnimationPlayer<class_AnimationPlayer>` to be played back. Animation tracks have different types, each with its own set of dedicated methods. Check :ref:`TrackType<enum_Animation_TrackType>` to see available types.
Animations are just data containers, and must be added to nodes such as an :ref:`AnimationPlayer<class_AnimationPlayer>` to be played back. Animation tracks have different types, each with its own set of dedicated methods. Check :ref:`TrackType<enum_Animation_TrackType>` to see available types.
- **TYPE_VALUE** = **0** --- Value tracks set values in node properties, but only those which can be Interpolated.
- **TYPE_VALUE** = **0** --- Value tracks set values in node properties, but only those which can be Interpolated.
-- **TYPE_TRANSFORM** = **1** --- Transform tracks are used to change node local transforms or skeleton pose bones. Transitions are interpolated.
+- **TYPE_TRANSFORM3D** = **1** --- Transform3D tracks are used to change node local transforms or skeleton pose bones of 3D nodes. Transitions are interpolated.
- **TYPE_METHOD** = **2** --- Method tracks call functions with given arguments per key.
- **TYPE_METHOD** = **2** --- Method tracks call functions with given arguments per key.
@@ -280,7 +297,7 @@ The total length of the animation (in seconds).
| *Getter* | has_loop() |
| *Getter* | has_loop() |
+-----------+-----------------+
+-----------+-----------------+
-A flag indicating that the animation must loop. This is uses for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
+A flag indicating that the animation must loop. This is used for correct interpolation of animation cycles, and for hinting the player that it must restart the animation.
----
----
@@ -311,7 +328,7 @@ Adds a track to the Animation.
-Sets the path of a track. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ``":"``.
+Sets the path of a track. Paths must be valid scene-tree paths to a node and must be specified starting from the parent node of the node that will reproduce the animation. Tracks that control properties or bones must append their name after the path, separated by ``":"``.
For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
@@ -737,7 +754,7 @@ Swaps the track ``idx``'s index position with the track ``with_idx``.
-Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position (:ref:`Vector3<class_Vector3>`), rotation (:ref:`Quat<class_Quat>`) and scale (:ref:`Vector3<class_Vector3>`).
+Returns the interpolated value of a transform track at a given time (in seconds). An array consisting of 3 elements: position (:ref:`Vector3<class_Vector3>`), rotation (:ref:`Quaternion<class_Quaternion>`) and scale (:ref:`Vector3<class_Vector3>`).
+- :ref:`AnimationNode<class_AnimationNode>` **_get_child_by_name** **(** :ref:`StringName<class_StringName>` name **)** |virtual| |const|
-Blend an animation by ``blend`` amount (name must be valid in the linked :ref:`AnimationPlayer<class_AnimationPlayer>`). A ``time`` and ``delta`` may be passed, as well as whether ``seek`` happened.
+Gets a child node by index (used by editors inheriting from :ref:`AnimationRootNode<class_AnimationRootNode>`).
-Blend an input. This is only useful for nodes created for an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`. The ``time`` parameter is a relative delta, unless ``seek`` is ``true``, in which case it is absolute. A filter mode may be optionally passed (see :ref:`FilterAction<enum_AnimationNode_FilterAction>` for options).
+Gets all children nodes in order as a ``name: node`` dictionary. Only useful when inheriting :ref:`AnimationRootNode<class_AnimationRootNode>`.
-Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from :ref:`AnimationRootNode<class_AnimationRootNode>` instead, else editors will not display your node for addition.
+Gets the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
-Gets the text caption for this node (used by some editors).
+Gets the property information for parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to :ref:`Object.get_property_list<class_Object_method_get_property_list>`.
-Gets all children nodes in order as a ``name: node`` dictionary. Only useful when inheriting :ref:`AnimationRootNode<class_AnimationRootNode>`.
+User-defined callback called when a custom node is processed. The ``time`` parameter is a relative delta, unless ``seek`` is ``true``, in which case it is absolute.
+
+Here, call the :ref:`blend_input<class_AnimationNode_method_blend_input>`, :ref:`blend_node<class_AnimationNode_method_blend_node>` or :ref:`blend_animation<class_AnimationNode_method_blend_animation>` functions. You can also use :ref:`get_parameter<class_AnimationNode_method_get_parameter>` and :ref:`set_parameter<class_AnimationNode_method_set_parameter>` to modify local memory.
+
+This function should return the time left for the current animation to finish (if unsure, pass the value from the main blend being called).
+Blend an animation by ``blend`` amount (name must be valid in the linked :ref:`AnimationPlayer<class_AnimationPlayer>`). A ``time`` and ``delta`` may be passed, as well as whether ``seek`` happened.
----
----
-.. _class_AnimationNode_method_get_parameter:
+.. _class_AnimationNode_method_blend_input:
-- :ref:`Variant<class_Variant>` **get_parameter** **(** :ref:`StringName<class_StringName>` name **)** const
-Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
+Blend an input. This is only useful for nodes created for an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`. The ``time`` parameter is a relative delta, unless ``seek`` is ``true``, in which case it is absolute. A filter mode may be optionally passed (see :ref:`FilterAction<enum_AnimationNode_FilterAction>` for options).
-Gets the default value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
+Blend another animation node (in case this node contains children animation nodes). This function is only useful if you inherit from :ref:`AnimationRootNode<class_AnimationRootNode>` instead, else editors will not display your node for addition.
-Gets the property information for parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees. Format is similar to :ref:`Object.get_property_list<class_Object_method_get_property_list>`.
+Amount of inputs in this node, only useful for nodes that go into :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
+- :ref:`Variant<class_Variant>` **get_parameter** **(** :ref:`StringName<class_StringName>` name **)** |const|
-Returns ``true`` whether a given path is filtered.
+Gets the value of a parameter. Parameters are custom local memory used for your nodes, given a resource can be reused in multiple trees.
----
----
-.. _class_AnimationNode_method_process:
-
-- void **process** **(** :ref:`float<class_float>` time, :ref:`bool<class_bool>` seek **)** virtual
-
-User-defined callback called when a custom node is processed. The ``time`` parameter is a relative delta, unless ``seek`` is ``true``, in which case it is absolute.
+.. _class_AnimationNode_method_is_path_filtered:
-Here, call the :ref:`blend_input<class_AnimationNode_method_blend_input>`, :ref:`blend_node<class_AnimationNode_method_blend_node>` or :ref:`blend_animation<class_AnimationNode_method_blend_animation>` functions. You can also use :ref:`get_parameter<class_AnimationNode_method_get_parameter>` and :ref:`set_parameter<class_AnimationNode_method_set_parameter>` to modify local memory.
Blends two animations additively inside of an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
Blends two animations additively inside of an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
@@ -47,3 +47,9 @@ Property Descriptions
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Blends two of three animations additively inside of an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
Blends two of three animations additively inside of an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
@@ -31,6 +31,8 @@ Tutorials
- :doc:`../tutorials/animation/animation_tree`
- :doc:`../tutorials/animation/animation_tree`
+- `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
+
Properties
Properties
----------
----------
@@ -55,3 +57,9 @@ Property Descriptions
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+- `Third Person Shooter Demo <https://godotengine.org/asset-library/asset/678>`__
+
Properties
Properties
----------
----------
@@ -47,3 +51,9 @@ Property Descriptions
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Blends two of three animations linearly inside of an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
Blends two of three animations linearly inside of an :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`.
@@ -55,3 +55,9 @@ Property Descriptions
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
If ``true``, sets the ``optimization`` to ``false`` when calling :ref:`AnimationNode.blend_input<class_AnimationNode_method_blend_input>`, forcing the blended animations to update every frame.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
@@ -141,7 +143,7 @@ Controls the interpolation between animations. See :ref:`BlendMode<enum_Animatio
- :ref:`Vector2<class_Vector2>` **max_space**
- :ref:`Vector2<class_Vector2>` **max_space**
+-----------+----------------------+
+-----------+----------------------+
-| *Default* | ``Vector2(1, 1)`` |
+| *Default* | ``Vector2(1, 1)`` |
+-----------+----------------------+
+-----------+----------------------+
| *Setter* | set_max_space(value) |
| *Setter* | set_max_space(value) |
+-----------+----------------------+
+-----------+----------------------+
@@ -156,13 +158,13 @@ The blend space's X and Y axes' upper limit for the points' position. See :ref:`
- :ref:`Vector2<class_Vector2>` **min_space**
- :ref:`Vector2<class_Vector2>` **min_space**
-+-----------+-----------------------+
-| *Default* | ``Vector2(-1, -1)`` |
-+-----------+-----------------------+
-| *Setter* | set_min_space(value) |
-+-----------+-----------------------+
-| *Getter* | get_min_space() |
-+-----------+-----------------------+
++-----------+----------------------+
+| *Default* | ``Vector2(-1, -1)`` |
++-----------+----------------------+
+| *Setter* | set_min_space(value) |
++-----------+----------------------+
+| *Getter* | get_min_space() |
++-----------+----------------------+
The blend space's X and Y axes' lower limit for the points' position. See :ref:`add_blend_point<class_AnimationNodeBlendSpace2D_method_add_blend_point>`.
The blend space's X and Y axes' lower limit for the points' position. See :ref:`add_blend_point<class_AnimationNodeBlendSpace2D_method_add_blend_point>`.
@@ -172,13 +174,13 @@ The blend space's X and Y axes' lower limit for the points' position. See :ref:`
- :ref:`Vector2<class_Vector2>` **snap**
- :ref:`Vector2<class_Vector2>` **snap**
-+-----------+-------------------------+
-| *Default* | ``Vector2(0.1, 0.1)`` |
-+-----------+-------------------------+
-| *Setter* | set_snap(value) |
-+-----------+-------------------------+
-| *Getter* | get_snap() |
-+-----------+-------------------------+
++-----------+-----------------------+
+| *Default* | ``Vector2(0.1, 0.1)`` |
++-----------+-----------------------+
+| *Setter* | set_snap(value) |
++-----------+-----------------------+
+| *Getter* | get_snap() |
++-----------+-----------------------+
Position increment to snap to when moving a point.
Position increment to snap to when moving a point.
@@ -235,7 +237,7 @@ Creates a new triangle using three points ``x``, ``y``, and ``z``. Triangles can
-Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the :ref:`AnimationTree<class_AnimationTree>` that can be controlled from code (see `https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code <https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code>`_). For example, if :ref:`AnimationTree.tree_root<class_AnimationTree_property_tree_root>` is an :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` and :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` is set to ``"idle"``:
+Turn on auto advance when this condition is set. The provided name will become a boolean parameter on the :ref:`AnimationTree<class_AnimationTree>` that can be controlled from code (see `https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code <https://docs.godotengine.org/en/latest/tutorials/animation/animation_tree.html#controlling-from-code>`__). For example, if :ref:`AnimationTree.tree_root<class_AnimationTree_property_tree_root>` is an :ref:`AnimationNodeStateMachine<class_AnimationNodeStateMachine>` and :ref:`advance_condition<class_AnimationNodeStateMachineTransition_property_advance_condition>` is set to ``"idle"``:
+
+
+.. tabs::
+
+ .. code-tab:: gdscript
+
+ $animation_tree.set("parameters/conditions/idle", is_on_floor and (linear_velocity.x == 0))
A time-seeking animation node to be used with :ref:`AnimationTree<class_AnimationTree>`.
A time-seeking animation node to be used with :ref:`AnimationTree<class_AnimationTree>`.
Description
Description
-----------
-----------
-This node can be used to cause a seek command to happen to any sub-children of the graph. After setting the time, this value returns to -1.
+This node can be used to cause a seek command to happen to any sub-children of the animation graph. Use this node type to play an :ref:`Animation<class_Animation>` from the start or a certain playback position inside the :ref:`AnimationNodeBlendTree<class_AnimationNodeBlendTree>`. After setting the time and changing the animation playback, the seek node automatically goes into sleep mode on the next process frame by setting its ``seek_position`` value to ``-1.0``.
-If the currently being played animation changes, this signal will notify of such change.
+Emitted when a queued animation plays after the previous animation was finished. See :ref:`queue<class_AnimationPlayer_method_queue>`.
+
+**Note:** The signal is not emitted when the animation is changed via :ref:`play<class_AnimationPlayer_method_play>` or from :ref:`AnimationTree<class_AnimationTree>`.
----
----
@@ -139,7 +147,7 @@ Notifies when the caches have been cleared, either automatically, or manually vi
- **ANIMATION_PROCESS_PHYSICS** = **0** --- Process animation during the physics process. This is especially useful when animating physics bodies.
- **ANIMATION_PROCESS_PHYSICS** = **0** --- Process animation during the physics process. This is especially useful when animating physics bodies.
@@ -214,7 +222,9 @@ The name of the animation to play when the scene loads.
| *Getter* | get_current_animation() |
| *Getter* | get_current_animation() |
+-----------+------------------------------+
+-----------+------------------------------+
-The name of the current animation, "" if not playing anything. When being set, does not restart the animation. See also :ref:`play<class_AnimationPlayer_method_play>`.
+The name of the currently playing animation. If no animation is playing, the property's value is an empty string. Changing this value does not restart the animation. See :ref:`play<class_AnimationPlayer_method_play>` for more information on playing animations.
+
+**Note:** while this property appears in the inspector, it's not meant to be edited, and it's not saved in the scene. This property is mainly used to get the currently playing animation, and internally for animation playback tracks. For more information, see :ref:`Animation<class_Animation>`.
----
----
@@ -290,15 +300,15 @@ The default time in which to blend animations. Ranges from 0 to 4096 with 0.01 p
+This is used by the editor. If set to ``true``, the scene will be saved with the effects of the reset animation applied (as if it had been seeked to time 0), then reverted after saving.
+
+In other words, the saved scene file will contain the "default pose", as defined by the reset animation, if any, with the editor keeping the values that the nodes had before saving.
+
+----
+
.. _class_AnimationPlayer_property_root_node:
.. _class_AnimationPlayer_property_root_node:
- :ref:`NodePath<class_NodePath>` **root_node**
- :ref:`NodePath<class_NodePath>` **root_node**
@@ -355,7 +383,7 @@ Shifts position in the animation timeline and immediately updates the animation.
Gets the actual playing speed of current animation or 0 if not playing. This speed is the :ref:`playback_speed<class_AnimationPlayer_property_playback_speed>` property multiplied by ``custom_speed`` argument specified when calling the :ref:`play<class_AnimationPlayer_method_play>` method.
Gets the actual playing speed of current animation or 0 if not playing. This speed is the :ref:`playback_speed<class_AnimationPlayer_property_playback_speed>` property multiplied by ``custom_speed`` argument specified when calling the :ref:`play<class_AnimationPlayer_method_play>` method.
@@ -435,7 +463,7 @@ Returns a list of the animation names that are currently queued to play.
.. _class_AnimationPlayer_method_has_animation:
.. _class_AnimationPlayer_method_has_animation:
-- :ref:`bool<class_bool>` **has_animation** **(** :ref:`StringName<class_StringName>` name **)** const
+- :ref:`bool<class_bool>` **has_animation** **(** :ref:`StringName<class_StringName>` name **)** |const|
Returns ``true`` if the ``AnimationPlayer`` stores an :ref:`Animation<class_Animation>` with key ``name``.
Returns ``true`` if the ``AnimationPlayer`` stores an :ref:`Animation<class_Animation>` with key ``name``.
@@ -443,7 +471,7 @@ Returns ``true`` if the ``AnimationPlayer`` stores an :ref:`Animation<class_Anim
@@ -521,3 +549,9 @@ Stops or pauses the currently playing animation. If ``reset`` is ``true``, the a
If ``reset`` is ``false``, the :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` will be kept and calling :ref:`play<class_AnimationPlayer_method_play>` or :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>` without arguments or with the same animation name as :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` will resume the animation.
If ``reset`` is ``false``, the :ref:`current_animation_position<class_AnimationPlayer_property_current_animation_position>` will be kept and calling :ref:`play<class_AnimationPlayer_method_play>` or :ref:`play_backwards<class_AnimationPlayer_method_play_backwards>` without arguments or with the same animation name as :ref:`assigned_animation<class_AnimationPlayer_property_assigned_animation>` will resume the animation.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
A node to be used for advanced animation transitions in an :ref:`AnimationPlayer<class_AnimationPlayer>`.
A node to be used for advanced animation transitions in an :ref:`AnimationPlayer<class_AnimationPlayer>`.
+Description
+-----------
+
+A node to be used for advanced animation transitions in an :ref:`AnimationPlayer<class_AnimationPlayer>`.
+
+**Note:** When linked with an :ref:`AnimationPlayer<class_AnimationPlayer>`, several properties and methods of the corresponding :ref:`AnimationPlayer<class_AnimationPlayer>` will not function as expected. Playback and transitions should be handled using only the ``AnimationTree`` and its constituent :ref:`AnimationNode<class_AnimationNode>`\ (s). The :ref:`AnimationPlayer<class_AnimationPlayer>` node should be used solely for adding, deleting, and editing animations.
- **ANIMATION_PROCESS_PHYSICS** = **0** --- The animations will progress during the physics frame (i.e. :ref:`Node._physics_process<class_Node_method__physics_process>`).
- **ANIMATION_PROCESS_PHYSICS** = **0** --- The animations will progress during the physics frame (i.e. :ref:`Node._physics_process<class_Node_method__physics_process>`).
@@ -100,19 +107,19 @@ The path to the :ref:`AnimationPlayer<class_AnimationPlayer>` used for animating
-The process mode of this ``AnimationTree``. See :ref:`AnimationProcessMode<enum_AnimationTree_AnimationProcessMode>` for available modes.
+The process mode of this ``AnimationTree``. See :ref:`AnimationProcessCallback<enum_AnimationTree_AnimationProcessCallback>` for available modes.
----
----
@@ -128,6 +135,10 @@ The process mode of this ``AnimationTree``. See :ref:`AnimationProcessMode<enum_
| *Getter* | get_root_motion_track() |
| *Getter* | get_root_motion_track() |
+-----------+------------------------------+
+-----------+------------------------------+
+The path to the Animation track used for root motion. Paths must be valid scene-tree paths to a node, and must be specified starting from the parent node of the node that will reproduce the animation. To specify a track that controls properties or bones, append its name after the path, separated by ``":"``. For example, ``"character/skeleton:ankle"`` or ``"character/mesh:transform/local"``.
+
+If the track has type :ref:`Animation.TYPE_TRANSFORM3D<class_Animation_constant_TYPE_TRANSFORM3D>`, the transformation will be cancelled visually, and the animation will appear to stay in place. See also :ref:`get_root_motion_transform<class_AnimationTree_method_get_root_motion_transform>` and :ref:`RootMotionView<class_RootMotionView>`.
+
----
----
.. _class_AnimationTree_property_tree_root:
.. _class_AnimationTree_property_tree_root:
@@ -155,7 +166,9 @@ Manually advance the animations by the specified time (in seconds).
+Retrieve the motion of the :ref:`root_motion_track<class_AnimationTree_property_root_motion_track>` as a :ref:`Transform3D<class_Transform3D>` that can be used elsewhere. If :ref:`root_motion_track<class_AnimationTree_property_root_motion_track>` is not a path to a track of type :ref:`Animation.TYPE_TRANSFORM3D<class_Animation_constant_TYPE_TRANSFORM3D>`, returns an identity transformation. See also :ref:`root_motion_track<class_AnimationTree_property_root_motion_track>` and :ref:`RootMotionView<class_RootMotionView>`.
----
----
@@ -163,3 +176,9 @@ Manually advance the animations by the specified time (in seconds).
-General-purpose area node for detection and 3D physics influence.
-
-Description
------------
-
-3D area that detects :ref:`CollisionObject<class_CollisionObject>` nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
-Emitted when another area enters, reporting which areas overlapped. ``shape_owner_get_owner(shape_find_owner(shape))`` returns the parent object of the owner of the ``shape``.
-Emitted when another area exits, reporting which areas were overlapping.
-
-----
-
-.. _class_Area_signal_body_entered:
-
-- **body_entered** **(** :ref:`Node<class_Node>` body **)**
-
-Emitted when a physics body enters.
-
-The ``body`` argument can either be a :ref:`PhysicsBody<class_PhysicsBody>` or a :ref:`GridMap<class_GridMap>` instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
-
-----
-
-.. _class_Area_signal_body_exited:
-
-- **body_exited** **(** :ref:`Node<class_Node>` body **)**
-
-Emitted when a physics body exits.
-
-The ``body`` argument can either be a :ref:`PhysicsBody<class_PhysicsBody>` or a :ref:`GridMap<class_GridMap>` instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
-Emitted when a physics body enters, reporting which shapes overlapped.
-
-The ``body`` argument can either be a :ref:`PhysicsBody<class_PhysicsBody>` or a :ref:`GridMap<class_GridMap>` instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
-Emitted when a physics body exits, reporting which shapes were overlapping.
-
-The ``body`` argument can either be a :ref:`PhysicsBody<class_PhysicsBody>` or a :ref:`GridMap<class_GridMap>` instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
-- **SPACE_OVERRIDE_DISABLED** = **0** --- This area does not affect gravity/damping.
-
-- **SPACE_OVERRIDE_COMBINE** = **1** --- This area adds its gravity/damping values to whatever has been calculated so far (in :ref:`priority<class_Area_property_priority>` order).
-
-- **SPACE_OVERRIDE_COMBINE_REPLACE** = **2** --- This area adds its gravity/damping values to whatever has been calculated so far (in :ref:`priority<class_Area_property_priority>` order), ignoring any lower priority areas.
-
-- **SPACE_OVERRIDE_REPLACE** = **3** --- This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
-
-- **SPACE_OVERRIDE_REPLACE_COMBINE** = **4** --- This area replaces any gravity/damping calculated so far (in :ref:`priority<class_Area_property_priority>` order), but keeps calculating the rest of the areas.
-
-Property Descriptions
----------------------
-
-.. _class_Area_property_angular_damp:
-
-- :ref:`float<class_float>` **angular_damp**
-
-+-----------+-------------------------+
-| *Default* | ``0.1`` |
-+-----------+-------------------------+
-| *Setter* | set_angular_damp(value) |
-+-----------+-------------------------+
-| *Getter* | get_angular_damp() |
-+-----------+-------------------------+
-
-The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from ``0`` (no damping) to ``1`` (full damping).
-If ``true``, the area's audio bus overrides the default audio bus.
-
-----
-
-.. _class_Area_property_collision_layer:
-
-- :ref:`int<class_int>` **collision_layer**
-
-+-----------+----------------------------+
-| *Default* | ``1`` |
-+-----------+----------------------------+
-| *Setter* | set_collision_layer(value) |
-+-----------+----------------------------+
-| *Getter* | get_collision_layer() |
-+-----------+----------------------------+
-
-The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also :ref:`collision_mask<class_Area_property_collision_mask>`.
-
-----
-
-.. _class_Area_property_collision_mask:
-
-- :ref:`int<class_int>` **collision_mask**
-
-+-----------+---------------------------+
-| *Default* | ``1`` |
-+-----------+---------------------------+
-| *Setter* | set_collision_mask(value) |
-+-----------+---------------------------+
-| *Getter* | get_collision_mask() |
-+-----------+---------------------------+
-
-The physics layers this area scans to determine collision detection.
-
-----
-
-.. _class_Area_property_gravity:
-
-- :ref:`float<class_float>` **gravity**
-
-+-----------+--------------------+
-| *Default* | ``9.8`` |
-+-----------+--------------------+
-| *Setter* | set_gravity(value) |
-+-----------+--------------------+
-| *Getter* | get_gravity() |
-+-----------+--------------------+
-
-The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
-The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
-
-----
-
-.. _class_Area_property_gravity_point:
-
-- :ref:`bool<class_bool>` **gravity_point**
-
-+-----------+-----------------------------+
-| *Default* | ``false`` |
-+-----------+-----------------------------+
-| *Setter* | set_gravity_is_point(value) |
-+-----------+-----------------------------+
-| *Getter* | is_gravity_a_point() |
-+-----------+-----------------------------+
-
-If ``true``, gravity is calculated from a point (set via :ref:`gravity_vec<class_Area_property_gravity_vec>`). See also :ref:`space_override<class_Area_property_space_override>`.
-
-----
-
-.. _class_Area_property_gravity_vec:
-
-- :ref:`Vector3<class_Vector3>` **gravity_vec**
-
-+-----------+---------------------------+
-| *Default* | ``Vector3( 0, -1, 0 )`` |
-+-----------+---------------------------+
-| *Setter* | set_gravity_vector(value) |
-+-----------+---------------------------+
-| *Getter* | get_gravity_vector() |
-+-----------+---------------------------+
-
-The area's gravity vector (not normalized). If gravity is a point (see :ref:`gravity_point<class_Area_property_gravity_point>`), this will be the point of attraction.
-
-----
-
-.. _class_Area_property_linear_damp:
-
-- :ref:`float<class_float>` **linear_damp**
-
-+-----------+------------------------+
-| *Default* | ``0.1`` |
-+-----------+------------------------+
-| *Setter* | set_linear_damp(value) |
-+-----------+------------------------+
-| *Getter* | get_linear_damp() |
-+-----------+------------------------+
-
-The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from ``0`` (no damping) to ``1`` (full damping).
-
-----
-
-.. _class_Area_property_monitorable:
-
-- :ref:`bool<class_bool>` **monitorable**
-
-+-----------+------------------------+
-| *Default* | ``true`` |
-+-----------+------------------------+
-| *Setter* | set_monitorable(value) |
-+-----------+------------------------+
-| *Getter* | is_monitorable() |
-+-----------+------------------------+
-
-If ``true``, other monitoring areas can detect this area.
-
-----
-
-.. _class_Area_property_monitoring:
-
-- :ref:`bool<class_bool>` **monitoring**
-
-+-----------+-----------------------+
-| *Default* | ``true`` |
-+-----------+-----------------------+
-| *Setter* | set_monitoring(value) |
-+-----------+-----------------------+
-| *Getter* | is_monitoring() |
-+-----------+-----------------------+
-
-If ``true``, the area detects bodies or areas entering and exiting it.
-
-----
-
-.. _class_Area_property_priority:
-
-- :ref:`float<class_float>` **priority**
-
-+-----------+---------------------+
-| *Default* | ``0.0`` |
-+-----------+---------------------+
-| *Setter* | set_priority(value) |
-+-----------+---------------------+
-| *Getter* | get_priority() |
-+-----------+---------------------+
-
-The area's priority. Higher priority areas are processed first.
-Returns a list of intersecting ``Area``\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
-Returns a list of intersecting :ref:`PhysicsBody<class_PhysicsBody>`\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
-
-----
-
-.. _class_Area_method_overlaps_area:
-
-- :ref:`bool<class_bool>` **overlaps_area** **(** :ref:`Node<class_Node>` area **)** const
-
-If ``true``, the given area overlaps the Area.
-
-**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
-
-----
-
-.. _class_Area_method_overlaps_body:
-
-- :ref:`bool<class_bool>` **overlaps_body** **(** :ref:`Node<class_Node>` body **)** const
-
-If ``true``, the given physics body overlaps the Area.
-
-**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
-
-The ``body`` argument can either be a :ref:`PhysicsBody<class_PhysicsBody>` or a :ref:`GridMap<class_GridMap>` instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
-
-----
-
-.. _class_Area_method_set_collision_layer_bit:
-
-- void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
-
-Set/clear individual bits on the layer mask. This simplifies editing this ``Area``'s layers.
-
-----
-
-.. _class_Area_method_set_collision_mask_bit:
-
-- void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
-
-Set/clear individual bits on the collision mask. This simplifies editing which ``Area`` layers this ``Area`` scans.
+2D area for detection and physics and audio influence.
Description
Description
-----------
-----------
-2D area that detects :ref:`CollisionObject2D<class_CollisionObject2D>` nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping).
+2D area that detects :ref:`CollisionObject2D<class_CollisionObject2D>` nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to a custom audio bus.
Tutorials
Tutorials
---------
---------
- :doc:`../tutorials/physics/using_area_2d`
- :doc:`../tutorials/physics/using_area_2d`
+- `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
+Emitted when one of another Area2D's :ref:`Shape2D<class_Shape2D>`\ s enters one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
+
+``area_id`` the :ref:`RID<class_RID>` of the other Area2D's :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+
+``area`` the other Area2D.
-Emitted when another area enters, reporting which shapes overlapped. ``shape_owner_get_owner(shape_find_owner(shape))`` returns the parent object of the owner of the ``shape``.
+``area_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of the other Area2D used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+
+``local_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+Emitted when one of another Area2D's :ref:`Shape2D<class_Shape2D>`\ s exits one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``.
+
+``area_id`` the :ref:`RID<class_RID>` of the other Area2D's :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+
+``area`` the other Area2D.
-Emitted when another area exits, reporting which shapes were overlapping.
+``area_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of the other Area2D used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+
+``local_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
----
----
.. _class_Area2D_signal_body_entered:
.. _class_Area2D_signal_body_entered:
-- **body_entered** **(** :ref:`Node<class_Node>` body **)**
+- **body_entered** **(** :ref:`Node2D<class_Node2D>` body **)**
-Emitted when a physics body enters.
+Emitted when a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` enters this Area2D. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
-The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
----
----
.. _class_Area2D_signal_body_exited:
.. _class_Area2D_signal_body_exited:
-- **body_exited** **(** :ref:`Node<class_Node>` body **)**
+- **body_exited** **(** :ref:`Node2D<class_Node2D>` body **)**
-Emitted when a physics body exits.
+Emitted when a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` exits this Area2D. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
-The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
+Emitted when one of a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`'s :ref:`Shape2D<class_Shape2D>`\ s enters one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
+
+``body_id`` the :ref:`RID<class_RID>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileSet<class_TileSet>`'s :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
-Emitted when a physics body enters, reporting which shapes overlapped.
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
-The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+``body_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+
+``local_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+Emitted when one of a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`'s :ref:`Shape2D<class_Shape2D>`\ s exits one of this Area2D's :ref:`Shape2D<class_Shape2D>`\ s. Requires :ref:`monitoring<class_Area2D_property_monitoring>` to be set to ``true``. :ref:`TileMap<class_TileMap>`\ s are detected if the :ref:`TileSet<class_TileSet>` has Collision :ref:`Shape2D<class_Shape2D>`\ s.
+
+``body_id`` the :ref:`RID<class_RID>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileSet<class_TileSet>`'s :ref:`CollisionObject2D<class_CollisionObject2D>` used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
+
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>`.
-Emitted when a physics body exits, reporting which shapes were overlapping.
+``body_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of the :ref:`PhysicsBody2D<class_PhysicsBody2D>` or :ref:`TileMap<class_TileMap>` used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
-The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+``local_shape`` the index of the :ref:`Shape2D<class_Shape2D>` of this Area2D used by the :ref:`PhysicsServer2D<class_PhysicsServer2D>`.
Enumerations
Enumerations
------------
------------
@@ -192,7 +218,9 @@ Property Descriptions
| *Getter* | get_angular_damp() |
| *Getter* | get_angular_damp() |
+-----------+-------------------------+
+-----------+-------------------------+
-The rate at which objects stop spinning in this area. Represents the angular velocity lost per second. Values range from ``0`` (no damping) to ``1`` (full damping).
+The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.
+
+See :ref:`ProjectSettings.physics/2d/default_angular_damp<class_ProjectSettings_property_physics/2d/default_angular_damp>` for more details about damping.
----
----
@@ -201,7 +229,7 @@ The rate at which objects stop spinning in this area. Represents the angular vel
@@ -228,51 +256,19 @@ If ``true``, the area's audio bus overrides the default audio bus.
----
----
-.. _class_Area2D_property_collision_layer:
-
-- :ref:`int<class_int>` **collision_layer**
-
-+-----------+----------------------------+
-| *Default* | ``1`` |
-+-----------+----------------------------+
-| *Setter* | set_collision_layer(value) |
-+-----------+----------------------------+
-| *Getter* | get_collision_layer() |
-+-----------+----------------------------+
-
-The area's physics layer(s). Collidable objects can exist in any of 32 different layers. A contact is detected if object A is in any of the layers that object B scans, or object B is in any layers that object A scans. See also :ref:`collision_mask<class_Area2D_property_collision_mask>`.
-
-----
-
-.. _class_Area2D_property_collision_mask:
-
-- :ref:`int<class_int>` **collision_mask**
-
-+-----------+---------------------------+
-| *Default* | ``1`` |
-+-----------+---------------------------+
-| *Setter* | set_collision_mask(value) |
-+-----------+---------------------------+
-| *Getter* | get_collision_mask() |
-+-----------+---------------------------+
-
-The physics layers this area scans to determine collision detection.
-
-----
-
.. _class_Area2D_property_gravity:
.. _class_Area2D_property_gravity:
- :ref:`float<class_float>` **gravity**
- :ref:`float<class_float>` **gravity**
+-----------+--------------------+
+-----------+--------------------+
-| *Default* | ``98.0`` |
+| *Default* | ``980.0`` |
+-----------+--------------------+
+-----------+--------------------+
| *Setter* | set_gravity(value) |
| *Setter* | set_gravity(value) |
+-----------+--------------------+
+-----------+--------------------+
| *Getter* | get_gravity() |
| *Getter* | get_gravity() |
+-----------+--------------------+
+-----------+--------------------+
-The area's gravity intensity (ranges from -1024 to 1024). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
+The area's gravity intensity (in pixels per second squared). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
----
----
@@ -313,7 +309,7 @@ If ``true``, gravity is calculated from a point (set via :ref:`gravity_vec<class
- :ref:`Vector2<class_Vector2>` **gravity_vec**
- :ref:`Vector2<class_Vector2>` **gravity_vec**
+-----------+---------------------------+
+-----------+---------------------------+
-| *Default* | ``Vector2(0, 1)`` |
+| *Default* | ``Vector2(0, 1)`` |
+-----------+---------------------------+
+-----------+---------------------------+
| *Setter* | set_gravity_vector(value) |
| *Setter* | set_gravity_vector(value) |
+-----------+---------------------------+
+-----------+---------------------------+
@@ -336,7 +332,9 @@ The area's gravity vector (not normalized). If gravity is a point (see :ref:`gra
| *Getter* | get_linear_damp() |
| *Getter* | get_linear_damp() |
+-----------+------------------------+
+-----------+------------------------+
-The rate at which objects stop moving in this area. Represents the linear velocity lost per second. Values range from ``0`` (no damping) to ``1`` (full damping).
+The rate at which objects stop moving in this area. Represents the linear velocity lost per second.
+
+See :ref:`ProjectSettings.physics/2d/default_linear_damp<class_ProjectSettings_property_physics/2d/default_linear_damp>` for more details about damping.
----
----
@@ -405,25 +403,9 @@ Override mode for gravity and damping calculations within this area. See :ref:`S
Method Descriptions
Method Descriptions
-------------------
-------------------
-.. _class_Area2D_method_get_collision_layer_bit:
-
-- :ref:`bool<class_bool>` **get_collision_layer_bit** **(** :ref:`int<class_int>` bit **)** const
-
-Returns an individual bit on the layer mask. Describes whether other areas will collide with this one on the given layer.
-
-----
-
-.. _class_Area2D_method_get_collision_mask_bit:
-
-- :ref:`bool<class_bool>` **get_collision_mask_bit** **(** :ref:`int<class_int>` bit **)** const
-
-Returns an individual bit on the collision mask. Describes whether this area will collide with others on the given layer.
Returns a list of intersecting ``Area2D``\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
Returns a list of intersecting ``Area2D``\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
@@ -431,7 +413,7 @@ Returns a list of intersecting ``Area2D``\ s. For performance reasons (collision
Returns a list of intersecting :ref:`PhysicsBody2D<class_PhysicsBody2D>`\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
Returns a list of intersecting :ref:`PhysicsBody2D<class_PhysicsBody2D>`\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
@@ -439,37 +421,27 @@ Returns a list of intersecting :ref:`PhysicsBody2D<class_PhysicsBody2D>`\ s. For
.. _class_Area2D_method_overlaps_area:
.. _class_Area2D_method_overlaps_area:
-- :ref:`bool<class_bool>` **overlaps_area** **(** :ref:`Node<class_Node>` area **)** const
+- :ref:`bool<class_bool>` **overlaps_area** **(** :ref:`Node<class_Node>` area **)** |const|
If ``true``, the given area overlaps the Area2D.
If ``true``, the given area overlaps the Area2D.
-**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+**Note:** The result of this test is not immediate after moving objects. For performance, the list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
----
----
.. _class_Area2D_method_overlaps_body:
.. _class_Area2D_method_overlaps_body:
-- :ref:`bool<class_bool>` **overlaps_body** **(** :ref:`Node<class_Node>` body **)** const
+- :ref:`bool<class_bool>` **overlaps_body** **(** :ref:`Node<class_Node>` body **)** |const|
If ``true``, the given physics body overlaps the Area2D.
If ``true``, the given physics body overlaps the Area2D.
**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
-The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
-
-----
-
-.. _class_Area2D_method_set_collision_layer_bit:
-
-- void **set_collision_layer_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
-
-Set/clear individual bits on the layer mask. This makes getting an area in/out of only one layer easier.
-
-----
-
-.. _class_Area2D_method_set_collision_mask_bit:
-
-- void **set_collision_mask_bit** **(** :ref:`int<class_int>` bit, :ref:`bool<class_bool>` value **)**
-
-Set/clear individual bits on the collision mask. This makes selecting the areas scanned easier.
+The ``body`` argument can either be a :ref:`PhysicsBody2D<class_PhysicsBody2D>` or a :ref:`TileMap<class_TileMap>` instance (while TileMaps are not physics bodies themselves, they register their tiles with collision shapes as a virtual physics body).
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+3D area for detection and physics and audio influence.
+
+Description
+-----------
+
+3D area that detects :ref:`CollisionObject3D<class_CollisionObject3D>` nodes overlapping, entering, or exiting. Can also alter or override local physics parameters (gravity, damping) and route audio to custom audio buses.
+Emitted when one of another Area3D's :ref:`Shape3D<class_Shape3D>`\ s enters one of this Area3D's :ref:`Shape3D<class_Shape3D>`\ s. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``.
+
+``area_id`` the :ref:`RID<class_RID>` of the other Area3D's :ref:`CollisionObject3D<class_CollisionObject3D>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``area`` the other Area3D.
+
+``area_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of the other Area3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``local_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of this Area3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+Emitted when one of another Area3D's :ref:`Shape3D<class_Shape3D>`\ s enters one of this Area3D's :ref:`Shape3D<class_Shape3D>`\ s. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``.
+
+``area_id`` the :ref:`RID<class_RID>` of the other Area3D's :ref:`CollisionObject3D<class_CollisionObject3D>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``area`` the other Area3D.
+
+``area_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of the other Area3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``local_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of this Area3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+----
+
+.. _class_Area3D_signal_body_entered:
+
+- **body_entered** **(** :ref:`Node3D<class_Node3D>` body **)**
+
+Emitted when a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` enters this Area3D. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
+
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
+
+----
+
+.. _class_Area3D_signal_body_exited:
+
+- **body_exited** **(** :ref:`Node3D<class_Node3D>` body **)**
+
+Emitted when a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` exits this Area3D. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
+
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the other :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
+Emitted when one of a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`'s :ref:`Shape3D<class_Shape3D>`\ s enters one of this Area3D's :ref:`Shape3D<class_Shape3D>`\ s. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
+
+``body_id`` the :ref:`RID<class_RID>` of the :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`MeshLibrary<class_MeshLibrary>`'s :ref:`CollisionObject3D<class_CollisionObject3D>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
+
+``body_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of the :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``local_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of this Area3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+Emitted when one of a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`'s :ref:`Shape3D<class_Shape3D>`\ s enters one of this Area3D's :ref:`Shape3D<class_Shape3D>`\ s. Requires :ref:`monitoring<class_Area3D_property_monitoring>` to be set to ``true``. :ref:`GridMap<class_GridMap>`\ s are detected if the :ref:`MeshLibrary<class_MeshLibrary>` has Collision :ref:`Shape3D<class_Shape3D>`\ s.
+
+``body_id`` the :ref:`RID<class_RID>` of the :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`MeshLibrary<class_MeshLibrary>`'s :ref:`CollisionObject3D<class_CollisionObject3D>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``body`` the :ref:`Node<class_Node>`, if it exists in the tree, of the :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>`.
+
+``body_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of the :ref:`PhysicsBody3D<class_PhysicsBody3D>` or :ref:`GridMap<class_GridMap>` used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+
+``local_shape`` the index of the :ref:`Shape3D<class_Shape3D>` of this Area3D used by the :ref:`PhysicsServer3D<class_PhysicsServer3D>`.
+- **SPACE_OVERRIDE_DISABLED** = **0** --- This area does not affect gravity/damping.
+
+- **SPACE_OVERRIDE_COMBINE** = **1** --- This area adds its gravity/damping values to whatever has been calculated so far (in :ref:`priority<class_Area3D_property_priority>` order).
+
+- **SPACE_OVERRIDE_COMBINE_REPLACE** = **2** --- This area adds its gravity/damping values to whatever has been calculated so far (in :ref:`priority<class_Area3D_property_priority>` order), ignoring any lower priority areas.
+
+- **SPACE_OVERRIDE_REPLACE** = **3** --- This area replaces any gravity/damping, even the defaults, ignoring any lower priority areas.
+
+- **SPACE_OVERRIDE_REPLACE_COMBINE** = **4** --- This area replaces any gravity/damping calculated so far (in :ref:`priority<class_Area3D_property_priority>` order), but keeps calculating the rest of the areas.
+
+Property Descriptions
+---------------------
+
+.. _class_Area3D_property_angular_damp:
+
+- :ref:`float<class_float>` **angular_damp**
+
++-----------+-------------------------+
+| *Default* | ``0.1`` |
++-----------+-------------------------+
+| *Setter* | set_angular_damp(value) |
++-----------+-------------------------+
+| *Getter* | get_angular_damp() |
++-----------+-------------------------+
+
+The rate at which objects stop spinning in this area. Represents the angular velocity lost per second.
+
+See :ref:`ProjectSettings.physics/3d/default_angular_damp<class_ProjectSettings_property_physics/3d/default_angular_damp>` for more details about damping.
+If ``true``, the area's audio bus overrides the default audio bus.
+
+----
+
+.. _class_Area3D_property_gravity:
+
+- :ref:`float<class_float>` **gravity**
+
++-----------+--------------------+
+| *Default* | ``9.8`` |
++-----------+--------------------+
+| *Setter* | set_gravity(value) |
++-----------+--------------------+
+| *Getter* | get_gravity() |
++-----------+--------------------+
+
+The area's gravity intensity (in meters per second squared). This value multiplies the gravity vector. This is useful to alter the force of gravity without altering its direction.
+The falloff factor for point gravity. The greater the value, the faster gravity decreases with distance.
+
+----
+
+.. _class_Area3D_property_gravity_point:
+
+- :ref:`bool<class_bool>` **gravity_point**
+
++-----------+-----------------------------+
+| *Default* | ``false`` |
++-----------+-----------------------------+
+| *Setter* | set_gravity_is_point(value) |
++-----------+-----------------------------+
+| *Getter* | is_gravity_a_point() |
++-----------+-----------------------------+
+
+If ``true``, gravity is calculated from a point (set via :ref:`gravity_vec<class_Area3D_property_gravity_vec>`). See also :ref:`space_override<class_Area3D_property_space_override>`.
+
+----
+
+.. _class_Area3D_property_gravity_vec:
+
+- :ref:`Vector3<class_Vector3>` **gravity_vec**
+
++-----------+---------------------------+
+| *Default* | ``Vector3(0, -1, 0)`` |
++-----------+---------------------------+
+| *Setter* | set_gravity_vector(value) |
++-----------+---------------------------+
+| *Getter* | get_gravity_vector() |
++-----------+---------------------------+
+
+The area's gravity vector (not normalized). If gravity is a point (see :ref:`gravity_point<class_Area3D_property_gravity_point>`), this will be the point of attraction.
+
+----
+
+.. _class_Area3D_property_linear_damp:
+
+- :ref:`float<class_float>` **linear_damp**
+
++-----------+------------------------+
+| *Default* | ``0.1`` |
++-----------+------------------------+
+| *Setter* | set_linear_damp(value) |
++-----------+------------------------+
+| *Getter* | get_linear_damp() |
++-----------+------------------------+
+
+The rate at which objects stop moving in this area. Represents the linear velocity lost per second.
+
+See :ref:`ProjectSettings.physics/3d/default_linear_damp<class_ProjectSettings_property_physics/3d/default_linear_damp>` for more details about damping.
+
+----
+
+.. _class_Area3D_property_monitorable:
+
+- :ref:`bool<class_bool>` **monitorable**
+
++-----------+------------------------+
+| *Default* | ``true`` |
++-----------+------------------------+
+| *Setter* | set_monitorable(value) |
++-----------+------------------------+
+| *Getter* | is_monitorable() |
++-----------+------------------------+
+
+If ``true``, other monitoring areas can detect this area.
+
+----
+
+.. _class_Area3D_property_monitoring:
+
+- :ref:`bool<class_bool>` **monitoring**
+
++-----------+-----------------------+
+| *Default* | ``true`` |
++-----------+-----------------------+
+| *Setter* | set_monitoring(value) |
++-----------+-----------------------+
+| *Getter* | is_monitoring() |
++-----------+-----------------------+
+
+If ``true``, the area detects bodies or areas entering and exiting it.
+
+----
+
+.. _class_Area3D_property_priority:
+
+- :ref:`float<class_float>` **priority**
+
++-----------+---------------------+
+| *Default* | ``0.0`` |
++-----------+---------------------+
+| *Setter* | set_priority(value) |
++-----------+---------------------+
+| *Getter* | get_priority() |
++-----------+---------------------+
+
+The area's priority. Higher priority areas are processed first.
+The :ref:`Node3D<class_Node3D>` which is used to specify the the direction and origin of an area-specific wind force. The direction is opposite to the z-axis of the :ref:`Node3D<class_Node3D>`'s local transform, and its origin is the origin of the :ref:`Node3D<class_Node3D>`'s local transform.
+Returns a list of intersecting ``Area3D``\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
+Returns a list of intersecting :ref:`PhysicsBody3D<class_PhysicsBody3D>`\ s. For performance reasons (collisions are all processed at the same time) this list is modified once during the physics step, not immediately after objects are moved. Consider using signals instead.
+
+----
+
+.. _class_Area3D_method_overlaps_area:
+
+- :ref:`bool<class_bool>` **overlaps_area** **(** :ref:`Node<class_Node>` area **)** |const|
+
+If ``true``, the given area overlaps the Area3D.
+
+**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+
+----
+
+.. _class_Area3D_method_overlaps_body:
+
+- :ref:`bool<class_bool>` **overlaps_body** **(** :ref:`Node<class_Node>` body **)** |const|
+
+If ``true``, the given physics body overlaps the Area3D.
+
+**Note:** The result of this test is not immediate after moving objects. For performance, list of overlaps is updated once per frame and before the physics step. Consider using signals instead.
+
+The ``body`` argument can either be a :ref:`PhysicsBody3D<class_PhysicsBody3D>` or a :ref:`GridMap<class_GridMap>` instance (while GridMaps are not physics body themselves, they register their tiles with collision shapes as a virtual physics body).
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
-Generic array which can contain several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 the second to last, etc.).
+A generic array that can contain several elements of any type, accessible by a numerical index starting at 0. Negative indices can be used to count from the back, like in Python (-1 is the last element, -2 is the second to last, etc.).
**Example:**
**Example:**
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var array = ["One", 2, 3, "Four"]
var array = ["One", 2, 3, "Four"]
print(array[0]) # One.
print(array[0]) # One.
@@ -27,155 +30,230 @@ Generic array which can contain several elements of any type, accessible by a nu
array[2] = "Three"
array[2] = "Three"
print(array[-2]) # Three.
print(array[-2]) # Three.
+ .. code-tab:: csharp
+
+ var array = new Godot.Collections.Array{"One", 2, 3, "Four"};
+ GD.Print(array[0]); // One.
+ GD.Print(array[2]); // 3.
+ GD.Print(array[array.Count - 1]); // Four.
+ array[2] = "Three";
+ GD.Print(array[array.Count - 2]); // Three.
+
+
+
Arrays can be concatenated using the ``+`` operator:
Arrays can be concatenated using the ``+`` operator:
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var array1 = ["One", 2]
var array1 = ["One", 2]
var array2 = [3, "Four"]
var array2 = [3, "Four"]
print(array1 + array2) # ["One", 2, 3, "Four"]
print(array1 + array2) # ["One", 2, 3, "Four"]
-Arrays are always passed by reference.
+ .. code-tab:: csharp
+
+ // Array concatenation is not possible with C# arrays, but is with Godot.Collections.Array.
+ var array1 = new Godot.Collections.Array{"One", 2};
+ var array2 = new Godot.Collections.Array{3, "Four"};
+ GD.Print(array1 + array2); // Prints [One, 2, 3, Four]
+
+
+
+**Note:** Concatenating with the ``+=`` operator will create a new array, which has a cost. If you want to append another array to an existing array, :ref:`append_array<class_Array_method_append_array>` is more efficient.
+
+**Note:** Arrays are always passed by reference. To get a copy of an array that can be modified independently of the original array, use :ref:`duplicate<class_Array_method_duplicate>`.
+
+**Note:** When declaring an array with ``const``, the array itself can still be mutated by defining the values at individual indices or pushing/removing elements. Using ``const`` will only prevent assigning the constant with another value after it was initialized.
+Returns the last element of the array. Prints an error and returns ``null`` if the array is empty.
-Returns the last element of the array, or ``null`` if the array is empty.
+**Note:** Calling this function is not the same as writing ``array[-1]``. If the array is empty, accessing by index will pause project execution when running from the editor.
----
----
@@ -207,11 +302,11 @@ Finds the index of an existing value (or the insertion index that maintains sort
Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a ``before`` specifier can be passed. If ``false``, the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return ``true`` if the first argument is less than the second, and return ``false`` otherwise.
Finds the index of an existing value (or the insertion index that maintains sorting order, if the value is not yet present in the array) using binary search and a custom comparison method. Optionally, a ``before`` specifier can be passed. If ``false``, the returned index comes after all existing entries of the value in the array. The custom method receives two arguments (an element from the array and the value searched for) and must return ``true`` if the first argument is less than the second, and return ``false`` otherwise.
-**Note:** Calling :ref:`bsearch<class_Array_method_bsearch>` on an unsorted array results in unexpected behavior.
+**Note:** Calling :ref:`bsearch_custom<class_Array_method_bsearch_custom>` on an unsorted array results in unexpected behavior.
----
----
@@ -225,7 +320,7 @@ Clears the array. This is equivalent to using :ref:`resize<class_Array_method_re
.. _class_Array_method_count:
.. _class_Array_method_count:
-- :ref:`int<class_int>` **count** **(** :ref:`Variant<class_Variant>` value **)**
+- :ref:`int<class_int>` **count** **(** :ref:`Variant<class_Variant>` value **)** |const|
Returns the number of times an element is in the array.
Returns the number of times an element is in the array.
@@ -233,7 +328,7 @@ Returns the number of times an element is in the array.
@@ -241,88 +336,193 @@ If ``deep`` is ``true``, a deep copy is performed: all nested arrays and diction
----
----
-.. _class_Array_method_empty:
+.. _class_Array_method_erase:
+
+- void **erase** **(** :ref:`Variant<class_Variant>` value **)**
-- :ref:`bool<class_bool>` **empty** **(** **)**
+Removes the first occurrence of a value from the array. To remove an element by index, use :ref:`remove<class_Array_method_remove>` instead.
-Returns ``true`` if the array is empty.
+**Note:** This method acts in-place and doesn't return a value.
+
+**Note:** On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed.
----
----
-.. _class_Array_method_erase:
+.. _class_Array_method_fill:
-- void **erase** **(** :ref:`Variant<class_Variant>` value **)**
+- void **fill** **(** :ref:`Variant<class_Variant>` value **)**
+
+Assigns the given value to all elements in the array. This can typically be used together with :ref:`resize<class_Array_method_resize>` to create an array with a given size and initialized elements:
+
+
+.. tabs::
+
+ .. code-tab:: gdscript
+
+ var array = []
+ array.resize(10)
+ array.fill(0) # Initialize the 10 elements to 0.
+
+ .. code-tab:: csharp
+
+ var array = new Godot.Collections.Array{};
+ array.Resize(10);
+ array.Fill(0); // Initialize the 10 elements to 0.
+Calls the provided :ref:`Callable<class_Callable>` on each element in the array and returns a new array with the elements for which the method returned ``true``.
+
+The callable's method should take one :ref:`Variant<class_Variant>` parameter (the current array element) and return a boolean value.
-Removes the first occurrence of a value from the array.
+::
+
+ func _ready():
+ print([1, 2, 3].filter(remove_1)) # Prints [2, 3].
+ print([1, 2, 3].filter(func(number): return number != 1)) # Same as above, but using lambda function.
-Returns the first element of the array, or ``null`` if the array is empty.
+Returns the first element of the array. Prints an error and returns ``null`` if the array is empty.
+
+**Note:** Calling this function is not the same as writing ``array[0]``. If the array is empty, accessing by index will pause project execution when running from the editor.
----
----
.. _class_Array_method_has:
.. _class_Array_method_has:
-- :ref:`bool<class_bool>` **has** **(** :ref:`Variant<class_Variant>` value **)**
+- :ref:`bool<class_bool>` **has** **(** :ref:`Variant<class_Variant>` value **)** |const|
Returns ``true`` if the array contains the given value.
Returns ``true`` if the array contains the given value.
-::
- ["inside", 7].has("inside") == true
- ["inside", 7].has("outside") == false
- ["inside", 7].has(7) == true
- ["inside", 7].has("7") == false
+.. tabs::
+
+ .. code-tab:: gdscript
+
+ print(["inside", 7].has("inside")) # True
+ print(["inside", 7].has("outside")) # False
+ print(["inside", 7].has(7)) # True
+ print(["inside", 7].has("7")) # False
+
+ .. code-tab:: csharp
+
+ var arr = new Godot.Collections.Array{"inside", 7};
+ // has is renamed to Contains
+ GD.Print(arr.Contains("inside")); // True
+ GD.Print(arr.Contains("outside")); // False
+ GD.Print(arr.Contains(7)); // True
+ GD.Print(arr.Contains("7")); // False
+
+
+
+
+
+**Note:** This is equivalent to using the ``in`` operator as follows:
+
+
+.. tabs::
+
+ .. code-tab:: gdscript
+
+ # Will evaluate to `true`.
+ if 2 in [2, 4, 6, 8]:
+ print("Contains!")
+
+ .. code-tab:: csharp
+
+ // As there is no "in" keyword in C#, you have to use Contains
+ var array = new Godot.Collections.Array{2, 4, 6, 8};
+Returns a hashed integer value representing the array and its contents.
-Returns a hashed integer value representing the array contents.
+**Note:** Arrays with equal contents can still produce different hashes. Only the exact same arrays will produce the same hashed integer value.
----
----
.. _class_Array_method_insert:
.. _class_Array_method_insert:
-- void **insert** **(** :ref:`int<class_int>` position, :ref:`Variant<class_Variant>` value **)**
+- :ref:`int<class_int>` **insert** **(** :ref:`int<class_int>` position, :ref:`Variant<class_Variant>` value **)**
Inserts a new element at a given position in the array. The position must be valid, or at the end of the array (``pos == size()``).
Inserts a new element at a given position in the array. The position must be valid, or at the end of the array (``pos == size()``).
+**Note:** This method acts in-place and doesn't return a value.
+
+**Note:** On large arrays, this method will be slower if the inserted element is close to the beginning of the array (index 0). This is because all elements placed after the newly inserted element have to be reindexed.
+Calls the provided :ref:`Callable<class_Callable>` for each element in the array and returns a new array filled with values returned by the method.
+
+The callable's method should take one :ref:`Variant<class_Variant>` parameter (the current array element) and can return any :ref:`Variant<class_Variant>`.
+
+::
+
+ func _ready():
+ print([1, 2, 3].map(negate)) # Prints [-1, -2, -3].
+ print([1, 2, 3].map(func(number): return -number)) # Same as above, but using lambda function.
+- :ref:`bool<class_bool>` **operator ==** **(** :ref:`Array<class_Array>` right **)** |operator|
+
+----
+
+.. _class_Array_method_operator >:
+
+- :ref:`bool<class_bool>` **operator >** **(** :ref:`Array<class_Array>` right **)** |operator|
+
+----
+
+.. _class_Array_method_operator >=:
+
+- :ref:`bool<class_bool>` **operator >=** **(** :ref:`Array<class_Array>` right **)** |operator|
+
+----
+
+.. _class_Array_method_operator []:
+
+- void **operator []** **(** :ref:`int<class_int>` index **)** |operator|
+
+----
+
+.. _class_Array_method_pop_at:
+
+- :ref:`Variant<class_Variant>` **pop_at** **(** :ref:`int<class_int>` position **)**
+
+Removes and returns the element of the array at index ``position``. If negative, ``position`` is considered relative to the end of the array. Leaves the array untouched and returns ``null`` if the array is empty or if it's accessed out of bounds. An error message is printed when the array is accessed out of bounds, but not when the array is empty.
+
+**Note:** On large arrays, this method can be slower than :ref:`pop_back<class_Array_method_pop_back>` as it will reindex the array's elements that are located after the removed element. The larger the array and the lower the index of the removed element, the slower :ref:`pop_at<class_Array_method_pop_at>` will be.
-Removes and returns the last element of the array. Returns ``null`` if the array is empty.
+Removes and returns the last element of the array. Returns ``null`` if the array is empty, without printing an error message. See also :ref:`pop_front<class_Array_method_pop_front>`.
----
----
@@ -348,7 +614,9 @@ Removes and returns the last element of the array. Returns ``null`` if the array
-Removes and returns the first element of the array. Returns ``null`` if the array is empty.
+Removes and returns the first element of the array. Returns ``null`` if the array is empty, without printing an error message. See also :ref:`pop_back<class_Array_method_pop_back>`.
+
+**Note:** On large arrays, this method is much slower than :ref:`pop_back<class_Array_method_pop_back>` as it will reindex all the array's elements every time it's called. The larger the array, the slower :ref:`pop_front<class_Array_method_pop_front>` will be.
----
----
@@ -356,7 +624,7 @@ Removes and returns the first element of the array. Returns ``null`` if the arra
- void **push_back** **(** :ref:`Variant<class_Variant>` value **)**
- void **push_back** **(** :ref:`Variant<class_Variant>` value **)**
-Appends an element at the end of the array.
+Appends an element at the end of the array. See also :ref:`push_front<class_Array_method_push_front>`.
----
----
@@ -364,7 +632,28 @@ Appends an element at the end of the array.
- void **push_front** **(** :ref:`Variant<class_Variant>` value **)**
- void **push_front** **(** :ref:`Variant<class_Variant>` value **)**
-Adds an element at the beginning of the array.
+Adds an element at the beginning of the array. See also :ref:`push_back<class_Array_method_push_back>`.
+
+**Note:** On large arrays, this method is much slower than :ref:`push_back<class_Array_method_push_back>` as it will reindex all the array's elements every time it's called. The larger the array, the slower :ref:`push_front<class_Array_method_push_front>` will be.
+Calls the provided :ref:`Callable<class_Callable>` for each element in array and accumulates the result in ``accum``.
+
+The callable's method takes two arguments: the current value of ``accum`` and the current array element. If ``accum`` is ``null`` (default value), the iteration will start from the second element, with the first one used as initial value of ``accum``.
+
+::
+
+ func _ready():
+ print([1, 2, 3].reduce(sum, 10)) # Prints 16.
+ print([1, 2, 3].reduce(func(accum, number): return accum + number, 10)) # Same as above, but using lambda function.
+
+ func sum(accum, number):
+ return accum + number
----
----
@@ -372,21 +661,33 @@ Adds an element at the beginning of the array.
- void **remove** **(** :ref:`int<class_int>` position **)**
- void **remove** **(** :ref:`int<class_int>` position **)**
-Removes an element from the array by index.
+Removes an element from the array by index. If the index does not exist in the array, nothing happens. To remove an element by searching for its value, use :ref:`erase<class_Array_method_erase>` instead.
+
+**Note:** This method acts in-place and doesn't return a value.
+
+**Note:** On large arrays, this method will be slower if the removed element is close to the beginning of the array (index 0). This is because all elements placed after the removed element have to be reindexed.
Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.
Searches the array in reverse order. Optionally, a start search index can be passed. If negative, the start index is considered relative to the end of the array.
@@ -396,13 +697,13 @@ Searches the array in reverse order. Optionally, a start search index can be pas
- void **shuffle** **(** **)**
- void **shuffle** **(** **)**
-Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as :ref:`@GDScript.randi<class_@GDScript_method_randi>`. Call :ref:`@GDScript.randomize<class_@GDScript_method_randomize>` to ensure that a new seed will be used each time if you want non-reproducible shuffling.
+Shuffles the array such that the items will have a random order. This method uses the global random number generator common to methods such as :ref:`@GlobalScope.randi<class_@GlobalScope_method_randi>`. Call :ref:`@GlobalScope.randomize<class_@GlobalScope_method_randomize>` to ensure that a new seed will be used each time if you want non-reproducible shuffling.
-Duplicates the subset described in the function and returns it in an array, deeply copying the array if ``deep`` is ``true``. Lower and upper index are inclusive, with the ``step`` describing the change between indices while slicing.
+Duplicates the subset described in the function and returns it in an array, deeply copying the array if ``deep`` is ``true``. Lower and upper index are inclusive, with the ``step`` describing the change between indices while slicing. Wraps around if ``begin`` or ``end`` are out of bounds or negative. Returns an empty array for invalid parameters.
----
----
@@ -424,23 +725,35 @@ Sorts the array.
**Note:** Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. Consider the following example:
**Note:** Strings are sorted in alphabetical order (as opposed to natural order). This may lead to unexpected behavior when sorting an array of strings ending with a sequence of numbers. Consider the following example:
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var strings = ["string1", "string2", "string10", "string11"]
var strings = ["string1", "string2", "string10", "string11"]
strings.sort()
strings.sort()
print(strings) # Prints [string1, string10, string11, string2]
print(strings) # Prints [string1, string10, string11, string2]
+ .. code-tab:: csharp
+
+ // There is no sort support for Godot.Collections.Array
-Sorts the array using a custom method. The arguments are an object that holds the method and the name of such method. The custom method receives two arguments (a pair of elements from the array) and must return either ``true`` or ``false``.
+Sorts the array using a custom method. The custom method receives two arguments (a pair of elements from the array) and must return either ``true`` or ``false``. For two elements ``a`` and ``b``, if the given method returns ``true``, element ``b`` will be after element ``a`` in the array.
-**Note:** you cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
+**Note:** You cannot randomize the return value as the heapsort algorithm expects a deterministic result. Doing so will result in unexpected behavior.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
class MyCustomSorter:
class MyCustomSorter:
static func sort_ascending(a, b):
static func sort_ascending(a, b):
@@ -449,6 +762,18 @@ Sorts the array using a custom method. The arguments are an object that holds th
return false
return false
var my_items = [[5, "Potato"], [9, "Rice"], [4, "Tomato"]]
var my_items = [[5, "Potato"], [9, "Rice"], [4, "Tomato"]]
-- **ARRAY_VERTEX** = **0** --- :ref:`PackedVector3Array<class_PackedVector3Array>`, :ref:`PackedVector2Array<class_PackedVector2Array>`, or :ref:`Array<class_Array>` of vertex positions.
-
-- **ARRAY_NORMAL** = **1** --- :ref:`PackedVector3Array<class_PackedVector3Array>` of vertex normals.
-
-- **ARRAY_TANGENT** = **2** --- :ref:`PackedFloat32Array<class_PackedFloat32Array>` of vertex tangents. Each element in groups of 4 floats, first 3 floats determine the tangent, and the last the binormal direction as -1 or 1.
-
-- **ARRAY_COLOR** = **3** --- :ref:`PackedColorArray<class_PackedColorArray>` of vertex colors.
-
-- **ARRAY_TEX_UV** = **4** --- :ref:`PackedVector2Array<class_PackedVector2Array>` for UV coordinates.
-
-- **ARRAY_TEX_UV2** = **5** --- :ref:`PackedVector2Array<class_PackedVector2Array>` for second UV coordinates.
-
-- **ARRAY_BONES** = **6** --- :ref:`PackedFloat32Array<class_PackedFloat32Array>` or :ref:`PackedInt32Array<class_PackedInt32Array>` of bone indices. Each element in groups of 4 floats.
-
-- **ARRAY_WEIGHTS** = **7** --- :ref:`PackedFloat32Array<class_PackedFloat32Array>` of bone weights. Each element in groups of 4 floats.
-
-- **ARRAY_INDEX** = **8** --- :ref:`PackedInt32Array<class_PackedInt32Array>` of integers used as indices referencing vertices, colors, normals, tangents, and textures. All of those arrays must have the same number of elements as the vertex array. No index can be beyond the vertex array size. When this index array is present, it puts the function into "index mode," where the index selects the \*i\*'th vertex, normal, tangent, color, UV, etc. This means if you want to have different normals or colors along an edge, you have to duplicate the vertices.
-
-For triangles, the index array is interpreted as triples, referring to the vertices of each triangle. For lines, the index array is in pairs indicating the start and end of each line.
-
-- **ARRAY_MAX** = **9** --- Represents the size of the :ref:`ArrayType<enum_ArrayMesh_ArrayType>` enum.
-- **ARRAY_FORMAT_VERTEX** = **1** --- Array format will include vertices (mandatory).
-- **ARRAY_FORMAT_NORMAL** = **2** --- Array format will include normals.
+The :ref:`MeshInstance3D<class_MeshInstance3D>` is ready to be added to the :ref:`SceneTree<class_SceneTree>` to be shown.
-- **ARRAY_FORMAT_TANGENT** = **4** --- Array format will include tangents.
+See also :ref:`ImmediateMesh<class_ImmediateMesh>`, :ref:`MeshDataTool<class_MeshDataTool>` and :ref:`SurfaceTool<class_SurfaceTool>` for procedural geometry generation.
-- **ARRAY_FORMAT_COLOR** = **8** --- Array format will include a color array.
+**Note:** Godot uses clockwise `winding order <https://learnopengl.com/Advanced-OpenGL/Face-culling>`__ for front faces of triangle primitive modes.
-- **ARRAY_FORMAT_TEX_UV** = **16** --- Array format will include UVs.
-
-- **ARRAY_FORMAT_TEX_UV2** = **32** --- Array format will include another set of UVs.
-
-- **ARRAY_FORMAT_BONES** = **64** --- Array format will include bone indices.
-
-- **ARRAY_FORMAT_WEIGHTS** = **128** --- Array format will include bone weights.
-
-- **ARRAY_FORMAT_INDEX** = **256** --- Index array will be used.
@@ -214,16 +149,28 @@ Sets the blend shape mode to one of :ref:`BlendShapeMode<enum_Mesh_BlendShapeMod
- :ref:`AABB<class_AABB>` **custom_aabb**
- :ref:`AABB<class_AABB>` **custom_aabb**
-+-----------+------------------------------+
-| *Default* | ``AABB(0, 0, 0, 0, 0, 0)`` |
-+-----------+------------------------------+
-| *Setter* | set_custom_aabb(value) |
-+-----------+------------------------------+
-| *Getter* | get_custom_aabb() |
-+-----------+------------------------------+
++-----------+----------------------------+
+| *Default* | ``AABB(0, 0, 0, 0, 0, 0)`` |
++-----------+----------------------------+
+| *Setter* | set_custom_aabb(value) |
++-----------+----------------------------+
+| *Getter* | get_custom_aabb() |
++-----------+----------------------------+
Overrides the :ref:`AABB<class_AABB>` with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices.
Overrides the :ref:`AABB<class_AABB>` with one defined by user for use with frustum culling. Especially useful to avoid unexpected culling when using a shader to offset vertices.
-Surfaces are created to be rendered using a ``primitive``, which may be any of the types defined in :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`. (As a note, when using indices, it is recommended to only use points, lines or triangles.) :ref:`Mesh.get_surface_count<class_Mesh_method_get_surface_count>` will become the ``surf_idx`` for this new surface.
-
-The ``arrays`` argument is an array of arrays. See :ref:`ArrayType<enum_ArrayMesh_ArrayType>` for the values used in this array. For example, ``arrays[0]`` is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array or be empty, except for :ref:`ARRAY_INDEX<class_ArrayMesh_constant_ARRAY_INDEX>` if it is used.
-
-Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data, and the index array defines the order of the vertices.
+Surfaces are created to be rendered using a ``primitive``, which may be any of the types defined in :ref:`PrimitiveType<enum_Mesh_PrimitiveType>`. (As a note, when using indices, it is recommended to only use points, lines, or triangles.) :ref:`Mesh.get_surface_count<class_Mesh_method_get_surface_count>` will become the ``surf_idx`` for this new surface.
-Godot uses clockwise winding order for front faces of triangle primitive modes.
+The ``arrays`` argument is an array of arrays. See :ref:`ArrayType<enum_Mesh_ArrayType>` for the values used in this array. For example, ``arrays[0]`` is the array of vertices. That first vertex sub-array is always required; the others are optional. Adding an index array puts this function into "index mode" where the vertex and other arrays become the sources of data and the index array defines the vertex order. All sub-arrays must have the same length as the vertex array or be empty, except for :ref:`Mesh.ARRAY_INDEX<class_Mesh_constant_ARRAY_INDEX>` if it is used.
----
----
@@ -269,7 +212,7 @@ Removes all surfaces from this ``ArrayMesh``.
Returns the length in indices of the index array in the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
Returns the length in indices of the index array in the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
@@ -317,7 +268,7 @@ Returns the length in indices of the index array in the requested surface (see :
Returns the length in vertices of the vertex array in the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
Returns the length in vertices of the vertex array in the requested surface (see :ref:`add_surface_from_arrays<class_ArrayMesh_method_add_surface_from_arrays>`).
@@ -325,7 +276,7 @@ Returns the length in vertices of the vertex array in the requested surface (see
-A camera node with a few overrules for AR/VR applied, such as location tracking.
-
-Description
------------
-
-This is a helper spatial node for our camera; note that, if stereoscopic rendering is applicable (VR-HMD), most of the camera properties are ignored, as the HMD information overrides them. The only properties that can be trusted are the near and far planes.
-
-The position and orientation of this node is automatically updated by the ARVR Server to represent the location of the HMD if such tracking is available and can thus be used by game logic. Note that, in contrast to the ARVR Controller, the render thread has access to the most up-to-date tracking data of the HMD and the location of the ARVRCamera can lag a few milliseconds behind what is used for rendering as a result.
-A spatial node representing a spatially-tracked controller.
-
-Description
------------
-
-This is a helper spatial node that is linked to the tracking of controllers. It also offers several handy passthroughs to the state of buttons and such on the controllers.
-
-Controllers are linked by their ID. You can create controller nodes before the controllers are available. If your game always uses two controllers (one for each hand), you can predefine the controllers with ID 1 and 2; they will become active as soon as the controllers are identified. If you expect additional controllers to be used, you should react to the signals and add ARVRController nodes to your scene.
-
-The position of the controller node is automatically updated by the :ref:`ARVRServer<class_ARVRServer>`. This makes this node ideal to add child nodes to visualize the controller.
-Emitted when the mesh associated with the controller changes or when one becomes available. Generally speaking this will be a static mesh after becoming available.
-
-Property Descriptions
----------------------
-
-.. _class_ARVRController_property_controller_id:
-
-- :ref:`int<class_int>` **controller_id**
-
-+-----------+--------------------------+
-| *Default* | ``1`` |
-+-----------+--------------------------+
-| *Setter* | set_controller_id(value) |
-+-----------+--------------------------+
-| *Getter* | get_controller_id() |
-+-----------+--------------------------+
-
-The controller's ID.
-
-A controller ID of 0 is unbound and will always result in an inactive node. Controller ID 1 is reserved for the first controller that identifies itself as the left-hand controller and ID 2 is reserved for the first controller that identifies itself as the right-hand controller.
-
-For any other controller that the :ref:`ARVRServer<class_ARVRServer>` detects, we continue with controller ID 3.
-
-When a controller is turned off, its slot is freed. This ensures controllers will keep the same ID even when controllers with lower IDs are turned off.
-
-----
-
-.. _class_ARVRController_property_rumble:
-
-- :ref:`float<class_float>` **rumble**
-
-+-----------+-------------------+
-| *Default* | ``0.0`` |
-+-----------+-------------------+
-| *Setter* | set_rumble(value) |
-+-----------+-------------------+
-| *Getter* | get_rumble() |
-+-----------+-------------------+
-
-The degree to which the controller vibrates. Ranges from ``0.0`` to ``1.0`` with precision ``.01``. If changed, updates :ref:`ARVRPositionalTracker.rumble<class_ARVRPositionalTracker_property_rumble>` accordingly.
-
-This is a useful property to animate if you want the controller to vibrate for a limited duration.
-Returns the ID of the joystick object bound to this. Every controller tracked by the :ref:`ARVRServer<class_ARVRServer>` that has buttons and axis will also be registered as a joystick within Godot. This means that all the normal joystick tracking and input mapping will work for buttons and axis found on the AR/VR controllers. This ID is purely offered as information so you can link up the controller with its joystick entry.
-If provided by the :ref:`ARVRInterface<class_ARVRInterface>`, this returns a mesh associated with the controller. This can be used to visualize the controller.
-Returns ``true`` if the button at index ``button`` is pressed. See :ref:`JoystickList<enum_@GlobalScope_JoystickList>`, in particular the ``JOY_VR_*`` constants.
-Base class for an AR/VR interface implementation.
-
-Description
------------
-
-This class needs to be implemented to make an AR or VR platform available to Godot and these should be implemented as C++ modules or GDNative modules (note that for GDNative the subclass ARVRScriptInterface should be used). Part of the interface is exposed to GDScript so you can detect, enable and configure an AR or VR platform.
-
-Interfaces should be written in such a way that simply enabling them will give us a working setup. You can query the available interfaces through :ref:`ARVRServer<class_ARVRServer>`.
-- **ARVR_NONE** = **0** --- No ARVR capabilities.
-
-- **ARVR_MONO** = **1** --- This interface can work with normal rendering output (non-HMD based AR).
-
-- **ARVR_STEREO** = **2** --- This interface supports stereoscopic rendering.
-
-- **ARVR_AR** = **4** --- This interface supports AR (video background and real world tracking).
-
-- **ARVR_EXTERNAL** = **8** --- This interface outputs to an external device. If the main viewport is used, the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of :ref:`get_render_targetsize<class_ARVRInterface_method_get_render_targetsize>`). Using a separate viewport node frees up the main viewport for other purposes.
-
-----
-
-.. _enum_ARVRInterface_Eyes:
-
-.. _class_ARVRInterface_constant_EYE_MONO:
-
-.. _class_ARVRInterface_constant_EYE_LEFT:
-
-.. _class_ARVRInterface_constant_EYE_RIGHT:
-
-enum **Eyes**:
-
-- **EYE_MONO** = **0** --- Mono output, this is mostly used internally when retrieving positioning information for our camera node or when stereo scopic rendering is not supported.
-
-- **EYE_LEFT** = **1** --- Left eye output, this is mostly used internally when rendering the image for the left eye and obtaining positioning and projection information.
-
-- **EYE_RIGHT** = **2** --- Right eye output, this is mostly used internally when rendering the image for the right eye and obtaining positioning and projection information.
-- **ARVR_NORMAL_TRACKING** = **0** --- Tracking is behaving as expected.
-
-- **ARVR_EXCESSIVE_MOTION** = **1** --- Tracking is hindered by excessive motion (the player is moving faster than tracking can keep up).
-
-- **ARVR_INSUFFICIENT_FEATURES** = **2** --- Tracking is hindered by insufficient features, it's too dark (for camera-based tracking), player is blocked, etc.
-
-- **ARVR_UNKNOWN_TRACKING** = **3** --- We don't know the status of the tracking or this interface does not provide feedback.
-
-- **ARVR_NOT_TRACKING** = **4** --- Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.).
-If this is an AR interface that requires displaying a camera feed as the background, this method returns the feed ID in the :ref:`CameraServer<class_CameraServer>` for this interface.
-If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.
-Call this to initialize this interface. The first interface that is initialized is identified as the primary interface and it will be used for rendering output.
-
-After initializing the interface you want to use you then need to enable the AR/VR mode of a viewport and rendering should commence.
-
-**Note:** You must enable the AR/VR mode on the main viewport for any device that uses the main output of Godot, such as for mobile VR.
-
-If you do this for a platform that handles its own output (such as OpenVR) Godot will show just one eye without distortion on screen. Alternatively, you can add a separate viewport node to your scene and enable AR/VR on that viewport. It will be used to output to the HMD, leaving you free to do anything you like in the main window, such as using a separate camera as a spectator camera or rendering something completely different.
-
-While currently not used, you can activate additional interfaces. You may wish to do this if you want to track controllers from other platforms. However, at this point in time only one interface can render to an HMD.
-This is a wrapper class for GDNative implementations of the ARVR interface. To use a GDNative ARVR interface, simply instantiate this object and set your GDNative library containing the ARVR interface implementation.
-.. Generated automatically by doc/tools/makerst.py in Godot's source tree.
-.. DO NOT EDIT THIS FILE, but the ARVRPositionalTracker.xml source instead.
-.. The source is found in doc/classes or modules/<name>/doc_classes.
-
-.. _class_ARVRPositionalTracker:
-
-ARVRPositionalTracker
-=====================
-
-**Inherits:** :ref:`Object<class_Object>`
-
-A tracked object.
-
-Description
------------
-
-An instance of this object represents a device that is tracked, such as a controller or anchor point. HMDs aren't represented here as they are handled internally.
-
-As controllers are turned on and the AR/VR interface detects them, instances of this object are automatically added to this list of active tracking objects accessible through the :ref:`ARVRServer<class_ARVRServer>`.
-
-The :ref:`ARVRController<class_ARVRController>` and :ref:`ARVRAnchor<class_ARVRAnchor>` both consume objects of this type and should be used in your project. The positional trackers are just under-the-hood objects that make this all work. These are mostly exposed so that GDNative-based interfaces can interact with them.
-Returns the internal tracker ID. This uniquely identifies the tracker per tracker type and matches the ID you need to specify for nodes such as the :ref:`ARVRController<class_ARVRController>` and :ref:`ARVRAnchor<class_ARVRAnchor>` nodes.
-- **tracker_added** **(** :ref:`StringName<class_StringName>` tracker_name, :ref:`int<class_int>` type, :ref:`int<class_int>` id **)**
-
-Emitted when a new tracker has been added. If you don't use a fixed number of controllers or if you're using :ref:`ARVRAnchor<class_ARVRAnchor>`\ s for an AR solution, it is important to react to this signal to add the appropriate :ref:`ARVRController<class_ARVRController>` or :ref:`ARVRAnchor<class_ARVRAnchor>` nodes related to this new tracker.
-
-----
-
-.. _class_ARVRServer_signal_tracker_removed:
-
-- **tracker_removed** **(** :ref:`StringName<class_StringName>` tracker_name, :ref:`int<class_int>` type, :ref:`int<class_int>` id **)**
-
-Emitted when a tracker is removed. You should remove any :ref:`ARVRController<class_ARVRController>` or :ref:`ARVRAnchor<class_ARVRAnchor>` points if applicable. This is not mandatory, the nodes simply become inactive and will be made active again when a new tracker becomes available (i.e. a new controller is switched on that takes the place of the previous one).
-- **RESET_FULL_ROTATION** = **0** --- Fully reset the orientation of the HMD. Regardless of what direction the user is looking to in the real world. The user will look dead ahead in the virtual world.
-
-- **RESET_BUT_KEEP_TILT** = **1** --- Resets the orientation but keeps the tilt of the device. So if we're looking down, we keep looking down but heading will be reset.
-
-- **DONT_RESET_ROTATION** = **2** --- Does not reset the orientation of the HMD, only the position of the player gets centered.
-This is an important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
-
-For platforms that do not offer spatial tracking, our origin point (0,0,0) is the location of our HMD, but you have little control over the direction the player is facing in the real world.
-
-For platforms that do offer spatial tracking, our origin point depends very much on the system. For OpenVR, our origin point is usually the center of the tracking space, on the ground. For other platforms, it's often the location of the tracking camera.
-
-This method allows you to center your tracker on the location of the HMD. It will take the current location of the HMD and use that to adjust all your tracking data; in essence, realigning the real world to your player's current position in the game world.
-
-For this method to produce usable results, tracking information must be available. This often takes a few frames after starting your game.
-
-You should call this method after a few seconds have passed. For instance, when the user requests a realignment of the display holding a designated button on a controller for a short period of time, or when implementing a teleport mechanism.
-
-----
-
-.. _class_ARVRServer_method_find_interface:
-
-- :ref:`ARVRInterface<class_ARVRInterface>` **find_interface** **(** :ref:`String<class_String>` name **)** const
-
-Finds an interface by its name. For instance, if your project uses capabilities of an AR/VR platform, you can find the interface for that platform by name and initialize it.
-Returns the number of interfaces currently registered with the AR/VR server. If your project supports multiple AR/VR platforms, you can look through the available interface, and either present the user with a selection or simply try to initialize each interface and use the first one that returns ``true``.
-Returns the absolute timestamp (in μs) of the last ``ARVRServer`` commit of the AR/VR eyes to :ref:`VisualServer<class_VisualServer>`. The value comes from an internal call to :ref:`OS.get_ticks_usec<class_OS_method_get_ticks_usec>`.
-Returns the duration (in μs) of the last frame. This is computed as the difference between :ref:`get_last_commit_usec<class_ARVRServer_method_get_last_commit_usec>` and :ref:`get_last_process_usec<class_ARVRServer_method_get_last_process_usec>` when committing.
-Returns the absolute timestamp (in μs) of the last ``ARVRServer`` process callback. The value comes from an internal call to :ref:`OS.get_ticks_usec<class_OS_method_get_ticks_usec>`.
+Container that preserves its child controls' aspect ratio.
+
+Description
+-----------
+
+Arranges child controls in a way to preserve their aspect ratio automatically whenever the container is resized. Solves the problem where the container size is dynamic and the contents' size needs to adjust accordingly without losing proportions.
+- **STRETCH_WIDTH_CONTROLS_HEIGHT** = **0** --- The height of child controls is automatically adjusted based on the width of the container.
+
+- **STRETCH_HEIGHT_CONTROLS_WIDTH** = **1** --- The width of child controls is automatically adjusted based on the height of the container.
+
+- **STRETCH_FIT** = **2** --- The bounding rectangle of child controls is automatically adjusted to fit inside the container while keeping the aspect ratio.
+
+- **STRETCH_COVER** = **3** --- The width and height of child controls is automatically adjusted to make their bounding rectangle cover the entire area of the container while keeping the aspect ratio.
+
+When the bounding rectangle of child controls exceed the container's size and :ref:`Control.rect_clip_content<class_Control_property_rect_clip_content>` is enabled, this allows to show only the container's area restricted by its own bounding rectangle.
+Specifies the vertical relative position of child controls.
+
+----
+
+.. _class_AspectRatioContainer_property_ratio:
+
+- :ref:`float<class_float>` **ratio**
+
++-----------+------------------+
+| *Default* | ``1.0`` |
++-----------+------------------+
+| *Setter* | set_ratio(value) |
++-----------+------------------+
+| *Getter* | get_ratio() |
++-----------+------------------+
+
+The aspect ratio to enforce on child controls. This is the width divided by the height. The ratio depends on the :ref:`stretch_mode<class_AspectRatioContainer_property_stretch_mode>`.
-An implementation of A\* to find shortest paths among connected points in space.
+An implementation of A\* to find the shortest paths among connected points in space.
Description
Description
-----------
-----------
@@ -22,7 +22,10 @@ You must add points manually with :ref:`add_point<class_AStar_method_add_point>`
It is also possible to use non-Euclidean distances. To do so, create a class that extends ``AStar`` and override methods :ref:`_compute_cost<class_AStar_method__compute_cost>` and :ref:`_estimate_cost<class_AStar_method__estimate_cost>`. Both take two indices and return a length, as is shown in the following example.
It is also possible to use non-Euclidean distances. To do so, create a class that extends ``AStar`` and override methods :ref:`_compute_cost<class_AStar_method__compute_cost>` and :ref:`_estimate_cost<class_AStar_method__estimate_cost>`. Both take two indices and return a length, as is shown in the following example.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
class MyAStar:
class MyAStar:
extends AStar
extends AStar
@@ -33,69 +36,87 @@ It is also possible to use non-Euclidean distances. To do so, create a class tha
func _estimate_cost(u, v):
func _estimate_cost(u, v):
return min(0, abs(u - v) - 1)
return min(0, abs(u - v) - 1)
+ .. code-tab:: csharp
+
+ public class MyAStar : AStar
+ {
+ public override float _ComputeCost(int u, int v)
+ {
+ return Mathf.Abs(u - v);
+ }
+ public override float _EstimateCost(int u, int v)
+ {
+ return Mathf.Min(0, Mathf.Abs(u - v) - 1);
+ }
+ }
+
+
+
:ref:`_estimate_cost<class_AStar_method__estimate_cost>` should return a lower bound of the distance, i.e. ``_estimate_cost(u, v) <= _compute_cost(u, v)``. This serves as a hint to the algorithm because the custom ``_compute_cost`` might be computation-heavy. If this is not the case, make :ref:`_estimate_cost<class_AStar_method__estimate_cost>` return the same value as :ref:`_compute_cost<class_AStar_method__compute_cost>` to provide the algorithm with the most accurate information.
:ref:`_estimate_cost<class_AStar_method__estimate_cost>` should return a lower bound of the distance, i.e. ``_estimate_cost(u, v) <= _compute_cost(u, v)``. This serves as a hint to the algorithm because the custom ``_compute_cost`` might be computation-heavy. If this is not the case, make :ref:`_estimate_cost<class_AStar_method__estimate_cost>` return the same value as :ref:`_compute_cost<class_AStar_method__compute_cost>` to provide the algorithm with the most accurate information.
+If the default :ref:`_estimate_cost<class_AStar_method__estimate_cost>` and :ref:`_compute_cost<class_AStar_method__compute_cost>` methods are used, or if the supplied :ref:`_estimate_cost<class_AStar_method__estimate_cost>` method returns a lower bound of the cost, then the paths returned by A\* will be the lowest-cost paths. Here, the cost of a path equals the sum of the :ref:`_compute_cost<class_AStar_method__compute_cost>` results of all segments in the path multiplied by the ``weight_scale``\ s of the endpoints of the respective segments. If the default methods are used and the ``weight_scale``\ s of all points are set to ``1.0``, then this equals the sum of Euclidean distances of all segments in the path.
-Adds a new point at the given position with the given identifier. The algorithm prefers points with lower ``weight_scale`` to form a path. The ``id`` must be 0 or larger, and the ``weight_scale`` must be 1 or larger.
+Adds a new point at the given position with the given identifier. The ``id`` must be 0 or larger, and the ``weight_scale`` must be 1 or larger.
+
+The ``weight_scale`` is multiplied by the result of :ref:`_compute_cost<class_AStar_method__compute_cost>` when determining the overall cost of traveling across a segment from a neighboring point to this point. Thus, all else being equal, the algorithm prefers points with lower ``weight_scale``\ s to form a path.
+
-::
+.. tabs::
+
+ .. code-tab:: gdscript
var astar = AStar.new()
var astar = AStar.new()
astar.add_point(1, Vector3(1, 0, 0), 4) # Adds the point (1, 0, 0) with weight_scale 4 and id 1
astar.add_point(1, Vector3(1, 0, 0), 4) # Adds the point (1, 0, 0) with weight_scale 4 and id 1
+ .. code-tab:: csharp
+
+ var astar = new AStar();
+ astar.AddPoint(1, new Vector3(1, 0, 0), 4); // Adds the point (1, 0, 0) with weight_scale 4 and id 1
+
+
+
If there already exists a point for the given ``id``, its position and weight scale are updated to the given values.
If there already exists a point for the given ``id``, its position and weight scale are updated to the given values.
Returns whether the two given points are directly connected by a segment. If ``bidirectional`` is ``false``, returns whether movement from ``id`` to ``to_id`` is possible through this segment.
Returns whether the two given points are directly connected by a segment. If ``bidirectional`` is ``false``, returns whether movement from ``id`` to ``to_id`` is possible through this segment.
@@ -150,13 +183,25 @@ Clears all the points and segments.
Creates a segment between the given points. If ``bidirectional`` is ``false``, only movement from ``id`` to ``to_id`` is allowed, not the reverse direction.
Creates a segment between the given points. If ``bidirectional`` is ``false``, only movement from ``id`` to ``to_id`` is allowed, not the reverse direction.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var astar = AStar.new()
var astar = AStar.new()
astar.add_point(1, Vector3(1, 1, 0))
astar.add_point(1, Vector3(1, 1, 0))
astar.add_point(2, Vector3(0, 5, 0))
astar.add_point(2, Vector3(0, 5, 0))
astar.connect_points(1, 2, false)
astar.connect_points(1, 2, false)
+ .. code-tab:: csharp
+
+ var astar = new AStar();
+ astar.AddPoint(1, new Vector3(1, 1, 0));
+ astar.AddPoint(2, new Vector3(0, 5, 0));
+ astar.ConnectPoints(1, 2, false);
+
+
+
----
----
.. _class_AStar_method_disconnect_points:
.. _class_AStar_method_disconnect_points:
@@ -169,7 +214,7 @@ Deletes the segment between the given points. If ``bidirectional`` is ``false``,
+Returns the ID of the closest point to ``to_position``, optionally taking disabled points into account. Returns ``-1`` if there are no points in the points pool.
-Returns the ID of the closest point to ``to_position``, optionally taking disabled points into account. Returns -1 if there are no points in the points pool.
+**Note:** If several points are the closest to ``to_position``, the one with the smallest ID will be returned, ensuring a deterministic result.
The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the closest position in the segment to the given point.
The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the closest position in the segment to the given point.
----
----
@@ -207,7 +267,10 @@ The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the clo
Returns an array with the IDs of the points that form the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
Returns an array with the IDs of the points that form the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var astar = AStar.new()
var astar = AStar.new()
astar.add_point(1, Vector3(0, 0, 0))
astar.add_point(1, Vector3(0, 0, 0))
@@ -222,13 +285,28 @@ Returns an array with the IDs of the points that form the path found by AStar be
var res = astar.get_id_path(1, 3) # Returns [1, 2, 3]
var res = astar.get_id_path(1, 3) # Returns [1, 2, 3]
+ .. code-tab:: csharp
+
+ var astar = new AStar();
+ astar.AddPoint(1, new Vector3(0, 0, 0));
+ astar.AddPoint(2, new Vector3(0, 1, 0), 1); // Default weight is 1
If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
Returns the number of points currently in the points pool.
Returns the number of points currently in the points pool.
@@ -269,11 +364,13 @@ Returns the number of points currently in the points pool.
Returns an array with the points that are in the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
Returns an array with the points that are in the path found by AStar between the given points. The array is ordered from the starting point to the ending point of the path.
+**Note:** This method is not thread-safe. If called from a :ref:`Thread<class_Thread>`, it will return an empty :ref:`PackedVector3Array<class_PackedVector3Array>` and will print an error message.
+
----
----
.. _class_AStar_method_get_point_position:
.. _class_AStar_method_get_point_position:
-- :ref:`Vector3<class_Vector3>` **get_point_position** **(** :ref:`int<class_int>` id **)** const
+- :ref:`Vector3<class_Vector3>` **get_point_position** **(** :ref:`int<class_int>` id **)** |const|
Returns the position of the point associated with the given ``id``.
Returns the position of the point associated with the given ``id``.
@@ -281,7 +378,7 @@ Returns the position of the point associated with the given ``id``.
.. _class_AStar_method_get_point_weight_scale:
.. _class_AStar_method_get_point_weight_scale:
-- :ref:`float<class_float>` **get_point_weight_scale** **(** :ref:`int<class_int>` id **)** const
+- :ref:`float<class_float>` **get_point_weight_scale** **(** :ref:`int<class_int>` id **)** |const|
Returns the weight scale of the point associated with the given ``id``.
Returns the weight scale of the point associated with the given ``id``.
@@ -297,7 +394,7 @@ Returns an array of all points.
.. _class_AStar_method_has_point:
.. _class_AStar_method_has_point:
-- :ref:`bool<class_bool>` **has_point** **(** :ref:`int<class_int>` id **)** const
+- :ref:`bool<class_bool>` **has_point** **(** :ref:`int<class_int>` id **)** |const|
Returns whether a point associated with the given ``id`` exists.
Returns whether a point associated with the given ``id`` exists.
@@ -305,7 +402,7 @@ Returns whether a point associated with the given ``id`` exists.
.. _class_AStar_method_is_point_disabled:
.. _class_AStar_method_is_point_disabled:
-- :ref:`bool<class_bool>` **is_point_disabled** **(** :ref:`int<class_int>` id **)** const
+- :ref:`bool<class_bool>` **is_point_disabled** **(** :ref:`int<class_int>` id **)** |const|
Returns whether a point is disabled or not for pathfinding. By default, all points are enabled.
Returns whether a point is disabled or not for pathfinding. By default, all points are enabled.
@@ -347,5 +444,11 @@ Sets the ``position`` for the point with the given ``id``.
-Sets the ``weight_scale`` for the point with the given ``id``.
+Sets the ``weight_scale`` for the point with the given ``id``. The ``weight_scale`` is multiplied by the result of :ref:`_compute_cost<class_AStar_method__compute_cost>` when determining the overall cost of traveling across a segment from a neighboring point to this point.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
-Adds a new point at the given position with the given identifier. The algorithm prefers points with lower ``weight_scale`` to form a path. The ``id`` must be 0 or larger, and the ``weight_scale`` must be 1 or larger.
+Adds a new point at the given position with the given identifier. The ``id`` must be 0 or larger, and the ``weight_scale`` must be 1 or larger.
-::
+The ``weight_scale`` is multiplied by the result of :ref:`_compute_cost<class_AStar2D_method__compute_cost>` when determining the overall cost of traveling across a segment from a neighboring point to this point. Thus, all else being equal, the algorithm prefers points with lower ``weight_scale``\ s to form a path.
+
+
+.. tabs::
+
+ .. code-tab:: gdscript
var astar = AStar2D.new()
var astar = AStar2D.new()
astar.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1
astar.add_point(1, Vector2(1, 0), 4) # Adds the point (1, 0) with weight_scale 4 and id 1
+ .. code-tab:: csharp
+
+ var astar = new AStar2D();
+ astar.AddPoint(1, new Vector2(1, 0), 4); // Adds the point (1, 0) with weight_scale 4 and id 1
+
+
+
If there already exists a point for the given ``id``, its position and weight scale are updated to the given values.
If there already exists a point for the given ``id``, its position and weight scale are updated to the given values.
Returns whether there is a connection/segment between the given points.
Returns whether there is a connection/segment between the given points.
@@ -133,13 +145,25 @@ Clears all the points and segments.
Creates a segment between the given points. If ``bidirectional`` is ``false``, only movement from ``id`` to ``to_id`` is allowed, not the reverse direction.
Creates a segment between the given points. If ``bidirectional`` is ``false``, only movement from ``id`` to ``to_id`` is allowed, not the reverse direction.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var astar = AStar2D.new()
var astar = AStar2D.new()
astar.add_point(1, Vector2(1, 1))
astar.add_point(1, Vector2(1, 1))
astar.add_point(2, Vector2(0, 5))
astar.add_point(2, Vector2(0, 5))
astar.connect_points(1, 2, false)
astar.connect_points(1, 2, false)
+ .. code-tab:: csharp
+
+ var astar = new AStar2D();
+ astar.AddPoint(1, new Vector2(1, 1));
+ astar.AddPoint(2, new Vector2(0, 5));
+ astar.ConnectPoints(1, 2, false);
+
+
+
----
----
.. _class_AStar2D_method_disconnect_points:
.. _class_AStar2D_method_disconnect_points:
@@ -152,7 +176,7 @@ Deletes the segment between the given points.
+Returns the ID of the closest point to ``to_position``, optionally taking disabled points into account. Returns ``-1`` if there are no points in the points pool.
-Returns the ID of the closest point to ``to_position``, optionally taking disabled points into account. Returns -1 if there are no points in the points pool.
+**Note:** If several points are the closest to ``to_position``, the one with the smallest ID will be returned, ensuring a deterministic result.
The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the closest position in the segment to the given point.
The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the closest position in the segment to the given point.
----
----
@@ -190,7 +229,10 @@ The result is in the segment that goes from ``y = 0`` to ``y = 5``. It's the clo
Returns an array with the IDs of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
Returns an array with the IDs of the points that form the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
-::
+
+.. tabs::
+
+ .. code-tab:: gdscript
var astar = AStar2D.new()
var astar = AStar2D.new()
astar.add_point(1, Vector2(0, 0))
astar.add_point(1, Vector2(0, 0))
@@ -205,13 +247,29 @@ Returns an array with the IDs of the points that form the path found by AStar2D
var res = astar.get_id_path(1, 3) # Returns [1, 2, 3]
var res = astar.get_id_path(1, 3) # Returns [1, 2, 3]
+ .. code-tab:: csharp
+
+ var astar = new AStar2D();
+ astar.AddPoint(1, new Vector2(0, 0));
+ astar.AddPoint(2, new Vector2(0, 1), 1); // Default weight is 1
If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
If you change the 2nd point's weight to 3, then the result will be ``[1, 4, 3]`` instead, because now even though the distance is longer, it's "easier" to get through point 4 than through point 2.
Returns the number of points currently in the points pool.
Returns the number of points currently in the points pool.
@@ -252,11 +328,13 @@ Returns the number of points currently in the points pool.
Returns an array with the points that are in the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
Returns an array with the points that are in the path found by AStar2D between the given points. The array is ordered from the starting point to the ending point of the path.
+**Note:** This method is not thread-safe. If called from a :ref:`Thread<class_Thread>`, it will return an empty :ref:`PackedVector2Array<class_PackedVector2Array>` and will print an error message.
+
----
----
.. _class_AStar2D_method_get_point_position:
.. _class_AStar2D_method_get_point_position:
-- :ref:`Vector2<class_Vector2>` **get_point_position** **(** :ref:`int<class_int>` id **)** const
+- :ref:`Vector2<class_Vector2>` **get_point_position** **(** :ref:`int<class_int>` id **)** |const|
Returns the position of the point associated with the given ``id``.
Returns the position of the point associated with the given ``id``.
@@ -264,7 +342,7 @@ Returns the position of the point associated with the given ``id``.
.. _class_AStar2D_method_get_point_weight_scale:
.. _class_AStar2D_method_get_point_weight_scale:
-- :ref:`float<class_float>` **get_point_weight_scale** **(** :ref:`int<class_int>` id **)** const
+- :ref:`float<class_float>` **get_point_weight_scale** **(** :ref:`int<class_int>` id **)** |const|
Returns the weight scale of the point associated with the given ``id``.
Returns the weight scale of the point associated with the given ``id``.
@@ -280,7 +358,7 @@ Returns an array of all points.
.. _class_AStar2D_method_has_point:
.. _class_AStar2D_method_has_point:
-- :ref:`bool<class_bool>` **has_point** **(** :ref:`int<class_int>` id **)** const
+- :ref:`bool<class_bool>` **has_point** **(** :ref:`int<class_int>` id **)** |const|
Returns whether a point associated with the given ``id`` exists.
Returns whether a point associated with the given ``id`` exists.
@@ -288,7 +366,7 @@ Returns whether a point associated with the given ``id`` exists.
.. _class_AStar2D_method_is_point_disabled:
.. _class_AStar2D_method_is_point_disabled:
-- :ref:`bool<class_bool>` **is_point_disabled** **(** :ref:`int<class_int>` id **)** const
+- :ref:`bool<class_bool>` **is_point_disabled** **(** :ref:`int<class_int>` id **)** |const|
Returns whether a point is disabled or not for pathfinding. By default, all points are enabled.
Returns whether a point is disabled or not for pathfinding. By default, all points are enabled.
@@ -330,5 +408,11 @@ Sets the ``position`` for the point with the given ``id``.
-Sets the ``weight_scale`` for the point with the given ``id``.
+Sets the ``weight_scale`` for the point with the given ``id``. The ``weight_scale`` is multiplied by the result of :ref:`_compute_cost<class_AStar2D_method__compute_cost>` when determining the overall cost of traveling across a segment from a neighboring point to this point.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
-Packs multiple small textures in a single, bigger one. Helps to optimize video memory costs and render calls.
+Crops out one part of a texture, such as a texture from a texture atlas.
Description
Description
-----------
-----------
-:ref:`Texture2D<class_Texture2D>` resource aimed at managing big textures files that pack multiple smaller textures. Consists of a :ref:`Texture2D<class_Texture2D>`, a margin that defines the border width, and a region that defines the actual area of the AtlasTexture.
+:ref:`Texture2D<class_Texture2D>` resource that crops out one part of the :ref:`atlas<class_AtlasTexture_property_atlas>` texture, defined by :ref:`region<class_AtlasTexture_property_region>`. The main use case is cropping out textures from a texture atlas, which is a big texture file that packs multiple smaller textures. Consists of a :ref:`Texture2D<class_Texture2D>` for the :ref:`atlas<class_AtlasTexture_property_atlas>`, a :ref:`region<class_AtlasTexture_property_region>` that defines the area of :ref:`atlas<class_AtlasTexture_property_atlas>` to use, and a :ref:`margin<class_AtlasTexture_property_margin>` that defines the border width.
+
+``AtlasTexture`` cannot be used in an :ref:`AnimatedTexture<class_AnimatedTexture>`, cannot be tiled in nodes such as :ref:`TextureRect<class_TextureRect>`, and does not work properly if used inside of other ``AtlasTexture`` resources. Multiple ``AtlasTexture`` resources can be used to crop multiple textures from the atlas. Using a texture atlas helps to optimize video memory costs and render calls compared to using multiple small files.
@@ -68,13 +70,13 @@ If ``true``, clips the area outside of the region to avoid bleeding of the surro
- :ref:`Rect2<class_Rect2>` **margin**
- :ref:`Rect2<class_Rect2>` **margin**
-+-----------+-------------------------+
-| *Default* | ``Rect2(0, 0, 0, 0)`` |
-+-----------+-------------------------+
-| *Setter* | set_margin(value) |
-+-----------+-------------------------+
-| *Getter* | get_margin() |
-+-----------+-------------------------+
++-----------+-----------------------+
+| *Default* | ``Rect2(0, 0, 0, 0)`` |
++-----------+-----------------------+
+| *Setter* | set_margin(value) |
++-----------+-----------------------+
+| *Getter* | get_margin() |
++-----------+-----------------------+
The margin around the region. The :ref:`Rect2<class_Rect2>`'s :ref:`Rect2.size<class_Rect2_property_size>` parameter ("w" and "h" in the editor) resizes the texture so it fits within the margin.
The margin around the region. The :ref:`Rect2<class_Rect2>`'s :ref:`Rect2.size<class_Rect2_property_size>` parameter ("w" and "h" in the editor) resizes the texture so it fits within the margin.
@@ -84,13 +86,19 @@ The margin around the region. The :ref:`Rect2<class_Rect2>`'s :ref:`Rect2.size<c
- :ref:`Rect2<class_Rect2>` **region**
- :ref:`Rect2<class_Rect2>` **region**
-+-----------+-------------------------+
-| *Default* | ``Rect2(0, 0, 0, 0)`` |
-+-----------+-------------------------+
-| *Setter* | set_region(value) |
-+-----------+-------------------------+
-| *Getter* | get_region() |
-+-----------+-------------------------+
++-----------+-----------------------+
+| *Default* | ``Rect2(0, 0, 0, 0)`` |
++-----------+-----------------------+
+| *Setter* | set_region(value) |
++-----------+-----------------------+
+| *Getter* | get_region() |
++-----------+-----------------------+
The AtlasTexture's used region.
The AtlasTexture's used region.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Stores position, muting, solo, bypass, effects, effect position, volume, and the connections between buses. See :ref:`AudioServer<class_AudioServer>` for usage.
Stores position, muting, solo, bypass, effects, effect position, volume, and the connections between buses. See :ref:`AudioServer<class_AudioServer>` for usage.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Limits the frequencies in a range around the :ref:`AudioEffectFilter.cutoff_hz<class_AudioEffectFilter_property_cutoff_hz>` and allows frequencies outside of this range to pass.
Limits the frequencies in a range around the :ref:`AudioEffectFilter.cutoff_hz<class_AudioEffectFilter_property_cutoff_hz>` and allows frequencies outside of this range to pass.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Attenuates the frequencies inside of a range around the :ref:`AudioEffectFilter.cutoff_hz<class_AudioEffectFilter_property_cutoff_hz>` and cuts frequencies outside of this band.
Attenuates the frequencies inside of a range around the :ref:`AudioEffectFilter.cutoff_hz<class_AudioEffectFilter_property_cutoff_hz>` and cuts frequencies outside of this band.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+AudioEffectCapture is an AudioEffect which copies all audio frames from the attached audio effect bus into its internal ring buffer.
+
+Application code should consume these audio frames from this ring buffer using :ref:`get_buffer<class_AudioEffectCapture_method_get_buffer>` and process it as needed, for example to capture data from a microphone, implement application defined effects, or to transmit audio over the network.
+Gets the next ``frames`` audio samples from the internal ring buffer.
+
+Returns a :ref:`PackedVector2Array<class_PackedVector2Array>` containing exactly ``frames`` audio samples if available, or an empty :ref:`PackedVector2Array<class_PackedVector2Array>` if insufficient data was available.
-Modify the sound and make it dirty. Different types are available: clip, tan, lo-fi (bit crushing), overdrive, or waveshape.
+Different types are available: clip, tan, lo-fi (bit crushing), overdrive, or waveshape.
By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently.
By distorting the waveform the frequency content change, which will often make the sound "crunchy" or "abrasive". For games, it can simulate sound coming from some saturated device or speaker very efficiently.
+Tutorials
+---------
+
+- :doc:`../tutorials/audio/audio_buses`
+
Properties
Properties
----------
----------
@@ -145,3 +150,9 @@ Increases or decreases the volume after the effect. Value can range from -80 to
Increases or decreases the volume before the effect. Value can range from -60 to 60.
Increases or decreases the volume before the effect. Value can range from -60 to 60.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Attenuates frequencies in a narrow band around the :ref:`AudioEffectFilter.cutoff_hz<class_AudioEffectFilter_property_cutoff_hz>` and cuts frequencies outside of this range.
Attenuates frequencies in a narrow band around the :ref:`AudioEffectFilter.cutoff_hz<class_AudioEffectFilter_property_cutoff_hz>` and cuts frequencies outside of this range.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+- **FFT_SIZE_256** = **0** --- Use a buffer of 256 samples for the Fast Fourier transform. Lowest latency, but least stable over time.
-- **FFT_SIZE_512** = **1**
+- **FFT_SIZE_512** = **1** --- Use a buffer of 512 samples for the Fast Fourier transform. Low latency, but less stable over time.
-- **FFT_SIZE_1024** = **2**
+- **FFT_SIZE_1024** = **2** --- Use a buffer of 1024 samples for the Fast Fourier transform. This is a compromise between latency and stability over time.
-- **FFT_SIZE_2048** = **3**
+- **FFT_SIZE_2048** = **3** --- Use a buffer of 2048 samples for the Fast Fourier transform. High latency, but stable over time.
-- **FFT_SIZE_4096** = **4**
+- **FFT_SIZE_4096** = **4** --- Use a buffer of 4096 samples for the Fast Fourier transform. Highest latency, but most stable over time.
-- **FFT_SIZE_MAX** = **5** --- Represents the size of the :ref:`FFT_Size<enum_AudioEffectPitchShift_FFT_Size>` enum.
+- **FFT_SIZE_MAX** = **5** --- Represents the size of the :ref:`FFTSize<enum_AudioEffectPitchShift_FFTSize>` enum.
+The size of the `Fast Fourier transform <https://en.wikipedia.org/wiki/Fast_Fourier_transform>`__ buffer. Higher values smooth out the effect over time, but have greater latency. The effects of this higher latency are especially noticeable on sounds that have sudden amplitude changes.
+The oversampling factor to use. Higher values result in better quality, but are more demanding on the CPU and may cause audio cracking if the CPU can't keep up.
-Pitch value. Can range from 0 (-1 octave) to 16 (+16 octaves).
+The pitch scale to use. ``1.0`` is the default pitch and plays sounds unaltered. :ref:`pitch_scale<class_AudioEffectPitchShift_property_pitch_scale>` can range from ``0.0`` (infinitely low pitch, inaudible) to ``16`` (16 times higher than the initial pitch).
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Audio effect used for recording sound from a microphone.
Audio effect used for recording sound from a microphone.
+Description
+-----------
+
+Allows the user to record sound from a microphone. It sets and gets the format in which the audio file will be recorded (8-bit, 16-bit, or compressed). It checks whether or not the recording is active, and if it is, records the sound. It then returns the recorded sample.
+- **FFT_SIZE_256** = **0** --- Use a buffer of 256 samples for the Fast Fourier transform. Lowest latency, but least stable over time.
-- **FFT_SIZE_512** = **1**
+- **FFT_SIZE_512** = **1** --- Use a buffer of 512 samples for the Fast Fourier transform. Low latency, but less stable over time.
-- **FFT_SIZE_1024** = **2**
+- **FFT_SIZE_1024** = **2** --- Use a buffer of 1024 samples for the Fast Fourier transform. This is a compromise between latency and stability over time.
-- **FFT_SIZE_2048** = **3**
+- **FFT_SIZE_2048** = **3** --- Use a buffer of 2048 samples for the Fast Fourier transform. High latency, but stable over time.
-- **FFT_SIZE_4096** = **4**
+- **FFT_SIZE_4096** = **4** --- Use a buffer of 4096 samples for the Fast Fourier transform. Highest latency, but most stable over time.
-- **FFT_SIZE_MAX** = **5** --- Represents the size of the :ref:`FFT_Size<enum_AudioEffectSpectrumAnalyzer_FFT_Size>` enum.
+- **FFT_SIZE_MAX** = **5** --- Represents the size of the :ref:`FFTSize<enum_AudioEffectSpectrumAnalyzer_FFTSize>` enum.
Property Descriptions
Property Descriptions
---------------------
---------------------
@@ -70,11 +84,13 @@ Property Descriptions
| *Getter* | get_buffer_length() |
| *Getter* | get_buffer_length() |
+-----------+--------------------------+
+-----------+--------------------------+
+The length of the buffer to keep (in seconds). Higher values keep data around for longer, but require more memory.
+The size of the `Fast Fourier transform <https://en.wikipedia.org/wiki/Fast_Fourier_transform>`__ buffer. Higher values smooth out the spectrum analysis over time, but have greater latency. The effects of this higher latency are especially noticeable with sudden amplitude changes.
+Once added to the scene tree and enabled using :ref:`make_current<class_AudioListener2D_method_make_current>`, this node will override the location sounds are heard from. Only one ``AudioListener2D`` can be current. Using :ref:`make_current<class_AudioListener2D_method_make_current>` will disable the previous ``AudioListener2D``.
+
+If there is no active ``AudioListener2D`` in the current :ref:`Viewport<class_Viewport>`, center of the screen will be used as a hearing point for the audio. ``AudioListener2D`` needs to be inside :ref:`SceneTree<class_SceneTree>` to function.
+Returns ``true`` if this ``AudioListener2D`` is currently active.
+
+----
+
+.. _class_AudioListener2D_method_make_current:
+
+- void **make_current** **(** **)**
+
+Makes the ``AudioListener2D`` active, setting it as the hearing point for the sounds. If there is already another active ``AudioListener2D``, it will be disabled.
+
+This method will have no effect if the ``AudioListener2D`` is not added to :ref:`SceneTree<class_SceneTree>`.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+Once added to the scene tree and enabled using :ref:`make_current<class_AudioListener3D_method_make_current>`, this node will override the location sounds are heard from. This can be used to listen from a location different from the :ref:`Camera3D<class_Camera3D>`.
+This audio stream does not play back sounds, but expects a script to generate audio data for it instead. See also :ref:`AudioStreamGeneratorPlayback<class_AudioStreamGeneratorPlayback>`.
+
+See also :ref:`AudioEffectSpectrumAnalyzer<class_AudioEffectSpectrumAnalyzer>` for performing real-time audio spectrum analysis.
+
+**Note:** Due to performance constraints, this class is best used from C# or from a compiled language via GDNative. If you still want to use this class from GDScript, consider using a lower :ref:`mix_rate<class_AudioStreamGenerator_property_mix_rate>` such as 11,025 Hz or 22,050 Hz.
+- `https://godotengine.org/article/godot-32-will-get-new-audio-features <Godot 3.2 will get new audio features>`__
Properties
Properties
----------
----------
@@ -42,6 +53,8 @@ Property Descriptions
| *Getter* | get_buffer_length() |
| *Getter* | get_buffer_length() |
+-----------+--------------------------+
+-----------+--------------------------+
+The length of the buffer to generate (in seconds). Lower values result in less latency, but require the script to generate audio data faster, resulting in increased CPU usage and more risk for audio cracking if the CPU can't keep up.
+
----
----
.. _class_AudioStreamGenerator_property_mix_rate:
.. _class_AudioStreamGenerator_property_mix_rate:
@@ -56,3 +69,15 @@ Property Descriptions
| *Getter* | get_mix_rate() |
| *Getter* | get_mix_rate() |
+-----------+---------------------+
+-----------+---------------------+
+The sample rate to use (in Hz). Higher values are more demanding for the CPU to generate, but result in better quality.
+
+In games, common sample rates in use are ``11025``, ``16000``, ``22050``, ``32000``, ``44100``, and ``48000``.
+
+According to the `Nyquist-Shannon sampling theorem <https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem>`__, there is no quality difference to human hearing when going past 40,000 Hz (since most humans can only hear up to ~20,000 Hz, often less). If you are generating lower-pitched sounds such as voices, lower sample rates such as ``32000`` or ``22050`` may be usable with no loss in quality.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
+Returns the number of audio data frames left to play. If this returned number reaches ``0``, the audio will stop playing until frames are added again. Therefore, make sure your script can always generate and push new audio frames fast enough to avoid audio cracking.
+Pushes several audio data frames to the buffer. This is usually more efficient than :ref:`push_frame<class_AudioStreamGeneratorPlayback_method_push_frame>` in C# and compiled languages via GDNative, but :ref:`push_buffer<class_AudioStreamGeneratorPlayback_method_push_buffer>` may be *less* efficient in GDScript.
+Pushes a single audio data frame to the buffer. This is usually less efficient than :ref:`push_buffer<class_AudioStreamGeneratorPlayback_method_push_buffer>` in C# and compiled languages via GDNative, but :ref:`push_frame<class_AudioStreamGeneratorPlayback_method_push_frame>` may be *more* efficient in GDScript.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
Can play, loop, pause a scroll through audio. See :ref:`AudioStream<class_AudioStream>` and :ref:`AudioStreamOGGVorbis<class_AudioStreamOGGVorbis>` for usage.
Can play, loop, pause a scroll through audio. See :ref:`AudioStream<class_AudioStream>` and :ref:`AudioStreamOGGVorbis<class_AudioStreamOGGVorbis>` for usage.
+To play audio positionally, use :ref:`AudioStreamPlayer2D<class_AudioStreamPlayer2D>` or :ref:`AudioStreamPlayer3D<class_AudioStreamPlayer3D>` instead of ``AudioStreamPlayer``.
+
Tutorials
Tutorials
---------
---------
- :doc:`../tutorials/audio/audio_streams`
- :doc:`../tutorials/audio/audio_streams`
+- `2D Dodge The Creeps Demo <https://godotengine.org/asset-library/asset/515>`__
+The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.
Plays audio that dampens with distance from screen center.
Plays audio that dampens with distance from screen center.
+See also :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` to play a sound non-positionally.
+
+**Note:** Hiding an ``AudioStreamPlayer2D`` node does not disable its audio output. To temporarily disable an ``AudioStreamPlayer2D``'s audio output, set :ref:`volume_db<class_AudioStreamPlayer2D_property_volume_db>` to a very low value like ``-100`` (which isn't audible to human hearing).
+The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.
-Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space.
+Plays a sound effect with directed sound effects, dampens with distance if needed, generates effect of hearable position in space. For greater realism, a low-pass filter is automatically applied to distant sounds. This can be disabled by setting :ref:`attenuation_filter_cutoff_hz<class_AudioStreamPlayer3D_property_attenuation_filter_cutoff_hz>` to ``20500``.
+
+By default, audio is heard from the camera position. This can be changed by adding a :ref:`AudioListener3D<class_AudioListener3D>` node to the scene and enabling it by calling :ref:`AudioListener3D.make_current<class_AudioListener3D_method_make_current>` on it.
+
+See also :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` to play a sound non-positionally.
+
+**Note:** Hiding an ``AudioStreamPlayer3D`` node does not disable its audio output. To temporarily disable an ``AudioStreamPlayer3D``'s audio output, set :ref:`unit_db<class_AudioStreamPlayer3D_property_unit_db>` to a very low value like ``-100`` (which isn't audible to human hearing).
-- **OUT_OF_RANGE_MIX** = **0** --- Mix this audio in, even when it's out of range.
-
-- **OUT_OF_RANGE_PAUSE** = **1** --- Pause this audio when it gets out of range.
+- **ATTENUATION_DISABLED** = **3** --- No dampening of loudness according to distance. The sound will still be heard positionally, unlike an :ref:`AudioStreamPlayer<class_AudioStreamPlayer>`.
----
----
@@ -176,7 +168,7 @@ Areas in which this sound plays.
+Dampens audio using a low-pass filter above this frequency, in Hz. To disable the dampening effect entirely, set this to ``20500`` as this frequency is above the human hearing limit.
----
----
@@ -192,7 +184,7 @@ Dampens audio above this frequency, in Hz.
| *Getter* | get_attenuation_filter_db() |
| *Getter* | get_attenuation_filter_db() |
+-----------+----------------------------------+
+-----------+----------------------------------+
-Amount how much the filter affects the loudness, in dB.
+Amount how much the filter affects the loudness, in decibels.
----
----
@@ -224,7 +216,7 @@ Decides if audio should get quieter with distance linearly, quadratically, logar
| *Getter* | is_autoplay_enabled() |
| *Getter* | is_autoplay_enabled() |
+-----------+-----------------------+
+-----------+-----------------------+
-If ``true``, audio plays when added to scene tree.
+If ``true``, audio plays when the AudioStreamPlayer3D node is added to scene tree.
----
----
@@ -233,14 +225,14 @@ If ``true``, audio plays when added to scene tree.
- :ref:`StringName<class_StringName>` **bus**
- :ref:`StringName<class_StringName>` **bus**
+-----------+----------------+
+-----------+----------------+
-| *Default* | ``@"Master"`` |
+| *Default* | ``&"Master"`` |
+-----------+----------------+
+-----------+----------------+
| *Setter* | set_bus(value) |
| *Setter* | set_bus(value) |
+-----------+----------------+
+-----------+----------------+
| *Getter* | get_bus() |
| *Getter* | get_bus() |
+-----------+----------------+
+-----------+----------------+
-Bus on which this audio is playing.
+The bus on which this audio is playing.
----
----
@@ -304,7 +296,7 @@ If ``true``, the audio should be dampened according to the direction of the soun
-Dampens audio if camera is outside of :ref:`emission_angle_degrees<class_AudioStreamPlayer3D_property_emission_angle_degrees>` and :ref:`emission_angle_enabled<class_AudioStreamPlayer3D_property_emission_angle_enabled>` is set by this factor, in dB.
+Dampens audio if camera is outside of :ref:`emission_angle_degrees<class_AudioStreamPlayer3D_property_emission_angle_degrees>` and :ref:`emission_angle_enabled<class_AudioStreamPlayer3D_property_emission_angle_enabled>` is set by this factor, in decibels.
----
----
@@ -320,7 +312,7 @@ Dampens audio if camera is outside of :ref:`emission_angle_degrees<class_AudioSt
| *Getter* | get_max_db() |
| *Getter* | get_max_db() |
+-----------+-------------------+
+-----------+-------------------+
-Sets the absolute maximum of the soundlevel, in dB.
+Sets the absolute maximum of the soundlevel, in decibels.
----
----
@@ -336,23 +328,23 @@ Sets the absolute maximum of the soundlevel, in dB.
| *Getter* | get_max_distance() |
| *Getter* | get_max_distance() |
+-----------+-------------------------+
+-----------+-------------------------+
-Sets the distance from which the :ref:`out_of_range_mode<class_AudioStreamPlayer3D_property_out_of_range_mode>` takes effect. Has no effect if set to 0.
+The distance past which the sound can no longer be heard at all. Only has an effect if set to a value greater than ``0.0``. :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` works in tandem with :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>`. However, unlike :ref:`unit_size<class_AudioStreamPlayer3D_property_unit_size>` whose behavior depends on the :ref:`attenuation_model<class_AudioStreamPlayer3D_property_attenuation_model>`, :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` always works in a linear fashion. This can be used to prevent the ``AudioStreamPlayer3D`` from requiring audio mixing when the listener is far away, which saves CPU resources.
-Decides if audio should pause when source is outside of :ref:`max_distance<class_AudioStreamPlayer3D_property_max_distance>` range.
+The maximum number of sounds this node can play at the same time. Playing additional sounds after this value is reached will cut off the oldest sounds.
----
----
@@ -368,7 +360,7 @@ Decides if audio should pause when source is outside of :ref:`max_distance<class
| *Getter* | get_pitch_scale() |
| *Getter* | get_pitch_scale() |
+-----------+------------------------+
+-----------+------------------------+
-Changes the pitch and the tempo of the audio.
+The pitch and the tempo of the audio, as a multiplier of the audio sample's sample rate.
----
----
@@ -396,7 +388,7 @@ If ``true``, audio is playing.
| *Getter* | get_stream() |
| *Getter* | get_stream() |
+----------+-------------------+
+----------+-------------------+
-The :ref:`AudioStream<class_AudioStream>` object to be played.
+The :ref:`AudioStream<class_AudioStream>` resource to be played.
----
----
@@ -412,7 +404,7 @@ The :ref:`AudioStream<class_AudioStream>` object to be played.
| *Getter* | get_stream_paused() |
| *Getter* | get_stream_paused() |
+-----------+--------------------------+
+-----------+--------------------------+
-If ``true``, the playback is paused. You can resume it by setting ``stream_paused`` to ``false``.
+If ``true``, the playback is paused. You can resume it by setting :ref:`stream_paused<class_AudioStreamPlayer3D_property_stream_paused>` to ``false``.
----
----
@@ -428,7 +420,7 @@ If ``true``, the playback is paused. You can resume it by setting ``stream_pause
| *Getter* | get_unit_db() |
| *Getter* | get_unit_db() |
+-----------+--------------------+
+-----------+--------------------+
-Base sound level unaffected by dampening, in dB.
+The base sound level unaffected by dampening, in decibels.
----
----
@@ -437,14 +429,14 @@ Base sound level unaffected by dampening, in dB.
- :ref:`float<class_float>` **unit_size**
- :ref:`float<class_float>` **unit_size**
+-----------+----------------------+
+-----------+----------------------+
-| *Default* | ``1.0`` |
+| *Default* | ``10.0`` |
+-----------+----------------------+
+-----------+----------------------+
| *Setter* | set_unit_size(value) |
| *Setter* | set_unit_size(value) |
+-----------+----------------------+
+-----------+----------------------+
| *Getter* | get_unit_size() |
| *Getter* | get_unit_size() |
+-----------+----------------------+
+-----------+----------------------+
-Factor for the attenuation effect.
+The factor for the attenuation effect. Higher values make the sound audible over a larger distance.
Method Descriptions
Method Descriptions
-------------------
-------------------
@@ -487,3 +479,9 @@ Sets the position from which audio will be played, in seconds.
Stops the audio.
Stops the audio.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
AudioStreamSample stores sound samples loaded from WAV files. To play the stored sound, use an :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` (for non-positional audio) or :ref:`AudioStreamPlayer2D<class_AudioStreamPlayer2D>`/:ref:`AudioStreamPlayer3D<class_AudioStreamPlayer3D>` (for positional audio). The sound can be looped.
AudioStreamSample stores sound samples loaded from WAV files. To play the stored sound, use an :ref:`AudioStreamPlayer<class_AudioStreamPlayer>` (for non-positional audio) or :ref:`AudioStreamPlayer2D<class_AudioStreamPlayer2D>`/:ref:`AudioStreamPlayer3D<class_AudioStreamPlayer3D>` (for positional audio). The sound can be looped.
-This class can also be used to store dynamically-generated PCM audio data.
+This class can also be used to store dynamically-generated PCM audio data. See also :ref:`AudioStreamGenerator<class_AudioStreamGenerator>` for procedural audio generation.
- **LOOP_DISABLED** = **0** --- Audio does not loop.
- **LOOP_DISABLED** = **0** --- Audio does not loop.
-- **LOOP_FORWARD** = **1** --- Audio loops the data between :ref:`loop_begin<class_AudioStreamSample_property_loop_begin>` and :ref:`loop_end<class_AudioStreamSample_property_loop_end>` playing forward only.
+- **LOOP_FORWARD** = **1** --- Audio loops the data between :ref:`loop_begin<class_AudioStreamSample_property_loop_begin>` and :ref:`loop_end<class_AudioStreamSample_property_loop_end>`, playing forward only.
-- **LOOP_PING_PONG** = **2** --- Audio loops the data between :ref:`loop_begin<class_AudioStreamSample_property_loop_begin>` and :ref:`loop_end<class_AudioStreamSample_property_loop_end>` playing back and forth.
+- **LOOP_PING_PONG** = **2** --- Audio loops the data between :ref:`loop_begin<class_AudioStreamSample_property_loop_begin>` and :ref:`loop_end<class_AudioStreamSample_property_loop_end>`, playing back and forth.
-- **LOOP_BACKWARD** = **3** --- Audio loops the data between :ref:`loop_begin<class_AudioStreamSample_property_loop_begin>` and :ref:`loop_end<class_AudioStreamSample_property_loop_end>` playing backward only.
+- **LOOP_BACKWARD** = **3** --- Audio loops the data between :ref:`loop_begin<class_AudioStreamSample_property_loop_begin>` and :ref:`loop_end<class_AudioStreamSample_property_loop_end>`, playing backward only.
@@ -136,7 +136,7 @@ Audio format. See :ref:`Format<enum_AudioStreamSample_Format>` constants for val
| *Getter* | get_loop_begin() |
| *Getter* | get_loop_begin() |
+-----------+-----------------------+
+-----------+-----------------------+
-Loop start in bytes.
+The loop start point (in number of samples, relative to the beginning of the sample). This information will be imported automatically from the WAV file if present.
----
----
@@ -152,7 +152,7 @@ Loop start in bytes.
| *Getter* | get_loop_end() |
| *Getter* | get_loop_end() |
+-----------+---------------------+
+-----------+---------------------+
-Loop end in bytes.
+The loop end point (in number of samples, relative to the beginning of the sample). This information will be imported automatically from the WAV file if present.
----
----
@@ -168,7 +168,7 @@ Loop end in bytes.
| *Getter* | get_loop_mode() |
| *Getter* | get_loop_mode() |
+-----------+----------------------+
+-----------+----------------------+
-Loop mode. See :ref:`LoopMode<enum_AudioStreamSample_LoopMode>` constants for values.
+The loop mode. This information will be imported automatically from the WAV file if present. See :ref:`LoopMode<enum_AudioStreamSample_LoopMode>` constants for values.
----
----
@@ -184,7 +184,11 @@ Loop mode. See :ref:`LoopMode<enum_AudioStreamSample_LoopMode>` constants for va
| *Getter* | get_mix_rate() |
| *Getter* | get_mix_rate() |
+-----------+---------------------+
+-----------+---------------------+
-The sample rate for mixing this audio.
+The sample rate for mixing this audio. Higher values require more storage space, but result in better quality.
+
+In games, common sample rates in use are ``11025``, ``16000``, ``22050``, ``32000``, ``44100``, and ``48000``.
+
+According to the `Nyquist-Shannon sampling theorem <https://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem>`__, there is no quality difference to human hearing when going past 40,000 Hz (since most humans can only hear up to ~20,000 Hz, often less). If you are using lower-pitched sounds such as voices, lower sample rates such as ``32000`` or ``22050`` may be usable with no loss in quality.
----
----
@@ -213,3 +217,9 @@ Saves the AudioStreamSample as a WAV file to ``path``. Samples with IMA ADPCM fo
**Note:** A ``.wav`` extension is automatically appended to ``path`` if it is missing.
**Note:** A ``.wav`` extension is automatically appended to ``path`` if it is missing.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
@@ -16,16 +16,18 @@ Copies a region of the screen (or the whole screen) to a buffer so it can be acc
Description
Description
-----------
-----------
-Node for back-buffering the currently-displayed screen. The region defined in the BackBufferCopy node is bufferized with the content of the screen it covers, or the entire screen according to the copy mode set. Use the ``texture(SCREEN_TEXTURE, ...)`` function in your shader scripts to access the buffer.
+Node for back-buffering the currently-displayed screen. The region defined in the BackBufferCopy node is buffered with the content of the screen it covers, or the entire screen according to the copy mode set. Use the ``texture(SCREEN_TEXTURE, ...)`` function in your shader scripts to access the buffer.
+
+**Note:** Since this node inherits from :ref:`Node2D<class_Node2D>` (and not :ref:`Control<class_Control>`), anchors and margins won't apply to child :ref:`Control<class_Control>`-derived nodes. This can be problematic when resizing the window. To avoid this, add :ref:`Control<class_Control>`-derived nodes as *siblings* to the BackBufferCopy node instead of adding them as children.
The area covered by the BackBufferCopy. Only used if :ref:`copy_mode<class_BackBufferCopy_property_copy_mode>` is :ref:`COPY_MODE_RECT<class_BackBufferCopy_constant_COPY_MODE_RECT>`.
The area covered by the BackBufferCopy. Only used if :ref:`copy_mode<class_BackBufferCopy_property_copy_mode>` is :ref:`COPY_MODE_RECT<class_BackBufferCopy_constant_COPY_MODE_RECT>`.
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
@@ -85,6 +87,8 @@ Emitted when the button stops being held down.
Emitted when the button is toggled or pressed. This is on :ref:`button_down<class_BaseButton_signal_button_down>` if :ref:`action_mode<class_BaseButton_property_action_mode>` is :ref:`ACTION_MODE_BUTTON_PRESS<class_BaseButton_constant_ACTION_MODE_BUTTON_PRESS>` and on :ref:`button_up<class_BaseButton_signal_button_up>` otherwise.
Emitted when the button is toggled or pressed. This is on :ref:`button_down<class_BaseButton_signal_button_down>` if :ref:`action_mode<class_BaseButton_property_action_mode>` is :ref:`ACTION_MODE_BUTTON_PRESS<class_BaseButton_constant_ACTION_MODE_BUTTON_PRESS>` and on :ref:`button_up<class_BaseButton_signal_button_up>` otherwise.
+If you need to know the button's pressed state (and :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active), use :ref:`toggled<class_BaseButton_signal_toggled>` instead.
+
----
----
.. _class_BaseButton_signal_toggled:
.. _class_BaseButton_signal_toggled:
@@ -153,6 +157,20 @@ Determines when the button is considered clicked, one of the :ref:`ActionMode<en
-Focus access mode to use when switching between enabled/disabled (see :ref:`Control.focus_mode<class_Control_property_focus_mode>` and :ref:`disabled<class_BaseButton_property_disabled>`).
@@ -231,6 +219,8 @@ Focus access mode to use when switching between enabled/disabled (see :ref:`Cont
If ``true``, the button stays pressed when moving the cursor outside the button while pressing it.
If ``true``, the button stays pressed when moving the cursor outside the button while pressing it.
+**Note:** This property only affects the button's visual appearance. Signals will be emitted at the same moment regardless of this property's value.
+
----
----
.. _class_BaseButton_property_pressed:
.. _class_BaseButton_property_pressed:
@@ -245,13 +235,15 @@ If ``true``, the button stays pressed when moving the cursor outside the button
| *Getter* | is_pressed() |
| *Getter* | is_pressed() |
+-----------+--------------------+
+-----------+--------------------+
-If ``true``, the button's state is pressed. Means the button is pressed down or toggled (if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active).
+If ``true``, the button's state is pressed. Means the button is pressed down or toggled (if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active). Only works if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is ``true``.
+
+**Note:** Setting :ref:`pressed<class_BaseButton_property_pressed>` will result in :ref:`toggled<class_BaseButton_signal_toggled>` to be emitted. If you want to change the pressed state without emitting that signal, use :ref:`set_pressed_no_signal<class_BaseButton_method_set_pressed_no_signal>`.
----
----
.. _class_BaseButton_property_shortcut:
.. _class_BaseButton_property_shortcut:
-- :ref:`ShortCut<class_ShortCut>` **shortcut**
+- :ref:`Shortcut<class_Shortcut>` **shortcut**
+----------+---------------------+
+----------+---------------------+
| *Setter* | set_shortcut(value) |
| *Setter* | set_shortcut(value) |
@@ -259,7 +251,21 @@ If ``true``, the button's state is pressed. Means the button is pressed down or
| *Getter* | get_shortcut() |
| *Getter* | get_shortcut() |
+----------+---------------------+
+----------+---------------------+
-:ref:`ShortCut<class_ShortCut>` associated to the button.
+:ref:`Shortcut<class_Shortcut>` associated to the button.
+
+----
+
+.. _class_BaseButton_property_shortcut_context:
+
+- :ref:`Node<class_Node>` **shortcut_context**
+
++----------+-----------------------------+
+| *Setter* | set_shortcut_context(value) |
++----------+-----------------------------+
+| *Getter* | get_shortcut_context() |
++----------+-----------------------------+
+
+The :ref:`Node<class_Node>` which must be a parent of the focused GUI :ref:`Control<class_Control>` for the shortcut to be activated. If ``null``, the shortcut can be activated when any control is focused (a global shortcut). This allows shortcuts to be accepted only when the user has a certain area of the GUI focused.
----
----
@@ -298,15 +304,15 @@ Method Descriptions
.. _class_BaseButton_method__pressed:
.. _class_BaseButton_method__pressed:
-- void **_pressed** **(** **)** virtual
+- void **_pressed** **(** **)** |virtual|
-Called when the button is pressed.
+Called when the button is pressed. If you need to know the button's pressed state (and :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is active), use :ref:`_toggled<class_BaseButton_method__toggled>` instead.
Returns the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the button is defined by the :ref:`DrawMode<enum_BaseButton_DrawMode>` enum.
Returns the visual state used to draw the button. This is useful mainly when implementing your own draw code by either overriding _draw() or connecting to "draw" signal. The visual state of the button is defined by the :ref:`DrawMode<enum_BaseButton_DrawMode>` enum.
@@ -322,7 +328,23 @@ Returns the visual state used to draw the button. This is useful mainly when imp
+Changes the :ref:`pressed<class_BaseButton_property_pressed>` state of the button, without emitting :ref:`toggled<class_BaseButton_signal_toggled>`. Use when you just want to change the state of the button without sending the pressed event (e.g. when initializing scene). Only works if :ref:`toggle_mode<class_BaseButton_property_toggle_mode>` is ``true``.
+
+**Note:** This method doesn't unpress other buttons in :ref:`button_group<class_BaseButton_property_button_group>`.
+
+.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
+.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
+.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
+.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
+.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
+.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
File diff ditekan karena terlalu besar
+ 465- 297
classes/class_basematerial3d.rst
Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini