diff options
Diffstat (limited to 'doc')
-rw-r--r-- | doc/classes/@GlobalScope.xml | 71 | ||||
-rw-r--r-- | doc/classes/CharacterBody2D.xml | 49 | ||||
-rw-r--r-- | doc/classes/Dictionary.xml | 3 | ||||
-rw-r--r-- | doc/classes/LineEdit.xml | 18 | ||||
-rw-r--r-- | doc/classes/MultiplayerPeerExtension.xml | 4 | ||||
-rw-r--r-- | doc/classes/Node.xml | 6 | ||||
-rw-r--r-- | doc/classes/PacketPeerExtension.xml | 4 | ||||
-rw-r--r-- | doc/classes/PhysicsServer2D.xml | 4 | ||||
-rw-r--r-- | doc/classes/PhysicsServer3D.xml | 4 | ||||
-rw-r--r-- | doc/classes/RigidDynamicBody2D.xml | 33 | ||||
-rw-r--r-- | doc/classes/RigidDynamicBody3D.xml | 33 | ||||
-rw-r--r-- | doc/classes/StreamPeerExtension.xml | 4 | ||||
-rw-r--r-- | doc/classes/TileData.xml | 30 | ||||
-rw-r--r-- | doc/classes/TileMap.xml | 18 | ||||
-rw-r--r-- | doc/classes/Translation.xml | 18 |
15 files changed, 219 insertions, 80 deletions
diff --git a/doc/classes/@GlobalScope.xml b/doc/classes/@GlobalScope.xml index 0334bab32a..fe0d7e4408 100644 --- a/doc/classes/@GlobalScope.xml +++ b/doc/classes/@GlobalScope.xml @@ -23,7 +23,7 @@ Returns the absolute value of float parameter [code]x[/code] (i.e. positive value). [codeblock] # a is 1.2 - a = absf(-1.2) + var a = absf(-1.2) [/codeblock] </description> </method> @@ -34,7 +34,7 @@ Returns the absolute value of int parameter [code]x[/code] (i.e. positive value). [codeblock] # a is 1 - a = absi(-1) + var a = absi(-1) [/codeblock] </description> </method> @@ -45,7 +45,7 @@ Returns the arc cosine of [code]x[/code] in radians. Use to get the angle of cosine [code]x[/code]. [code]x[/code] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method acos] will return [constant @GDScript.NAN]. [codeblock] # c is 0.523599 or 30 degrees if converted with rad2deg(c) - c = acos(0.866025) + var c = acos(0.866025) [/codeblock] </description> </method> @@ -56,7 +56,7 @@ Returns the arc sine of [code]x[/code] in radians. Use to get the angle of sine [code]x[/code]. [code]x[/code] must be between [code]-1.0[/code] and [code]1.0[/code] (inclusive), otherwise, [method asin] will return [constant @GDScript.NAN]. [codeblock] # s is 0.523599 or 30 degrees if converted with rad2deg(s) - s = asin(0.5) + var s = asin(0.5) [/codeblock] </description> </method> @@ -64,11 +64,12 @@ <return type="float" /> <argument index="0" name="x" type="float" /> <description> - Returns the arc tangent of [code]x[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry: [code]atan(tan(angle)) == angle[/code]. + Returns the arc tangent of [code]x[/code] in radians. Use it to get the angle from an angle's tangent in trigonometry. The method cannot know in which quadrant the angle should fall. See [method atan2] if you have both [code]y[/code] and [code]x[/code]. [codeblock] - a = atan(0.5) # a is 0.463648 + var a = atan(0.5) # a is 0.463648 [/codeblock] + If [code]x[/code] is between [code]-PI / 2[/code] and [code]PI / 2[/code] (inclusive), [code]atan(tan(x))[/code] is equal to [code]x[/code]. </description> </method> <method name="atan2"> @@ -79,7 +80,7 @@ Returns the arc tangent of [code]y/x[/code] in radians. Use to get the angle of tangent [code]y/x[/code]. To compute the value, the method takes into account the sign of both arguments in order to determine the quadrant. Important note: The Y coordinate comes first, by convention. [codeblock] - a = atan2(0, -1) # a is 3.141593 + var a = atan2(0, -1) # a is 3.141593 [/codeblock] </description> </method> @@ -105,8 +106,8 @@ <description> Rounds [code]x[/code] upward (towards positive infinity), returning the smallest whole number that is not less than [code]x[/code]. [codeblock] - i = ceil(1.45) # i is 2 - i = ceil(1.001) # i is 2 + var i = ceil(1.45) # i is 2.0 + i = ceil(1.001) # i is 2.0 [/codeblock] See also [method floor], [method round], and [method snapped]. </description> @@ -127,9 +128,9 @@ <description> Clamps the float [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. [codeblock] - speed = 42.1 + var speed = 42.1 # a is 20.0 - a = clampf(speed, 1.0, 20.0) + var a = clampf(speed, 1.0, 20.0) speed = -10.0 # a is -1.0 @@ -145,9 +146,9 @@ <description> Clamps the integer [code]value[/code] and returns a value not less than [code]min[/code] and not more than [code]max[/code]. [codeblock] - speed = 42 + var speed = 42 # a is 20 - a = clampi(speed, 1, 20) + var a = clampi(speed, 1, 20) speed = -10 # a is -1 @@ -161,9 +162,9 @@ <description> Returns the cosine of angle [code]angle_rad[/code] in radians. [codeblock] - # Prints 1 then -1 - print(cos(PI * 2)) - print(cos(PI)) + cos(PI * 2) # Returns 1.0 + cos(PI) # Returns -1.0 + cos(deg2rad(90)) # Returns 0.0 [/codeblock] </description> </method> @@ -192,7 +193,7 @@ Converts an angle expressed in degrees to radians. [codeblock] # r is 3.141593 - r = deg2rad(180) + var r = deg2rad(180) [/codeblock] </description> </method> @@ -201,7 +202,18 @@ <argument index="0" name="x" type="float" /> <argument index="1" name="curve" type="float" /> <description> - Easing function, based on exponent. The curve values are: 0 is constant, 1 is linear, 0 to 1 is ease-in, 1+ is ease out. Negative values are in-out/out in. + Returns an "eased" value of [code]x[/code] based on an easing function defined with [code]curve[/code]. This easing function is based on an exponent. The [code]curve[/code] can be any floating-point number, with specific values leading to the following behaviors: + [codeblock] + - Lower than -1.0 (exclusive): Ease in-out + - 1.0: Linear + - Between -1.0 and 0.0 (exclusive): Ease out-in + - 0.0: Constant + - Between 0.0 to 1.0 (exclusive): Ease in + - 1.0: Linear + - Greater than 1.0 (exclusive): Ease out + [/codeblock] + [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/ease_cheatsheet.png]ease() curve values cheatsheet[/url] + See also [method smoothstep]. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer]. </description> </method> <method name="error_string"> @@ -219,7 +231,7 @@ [b]e[/b] has an approximate value of 2.71828, and can be obtained with [code]exp(1)[/code]. For exponents to other bases use the method [method pow]. [codeblock] - a = exp(2) # Approximately 7.39 + var a = exp(2) # Approximately 7.39 [/codeblock] </description> </method> @@ -230,7 +242,7 @@ Rounds [code]x[/code] downward (towards negative infinity), returning the largest whole number that is not more than [code]x[/code]. [codeblock] # a is 2.0 - a = floor(2.99) + var a = floor(2.99) # a is -3.0 a = floor(-2.99) [/codeblock] @@ -550,7 +562,7 @@ <description> Converts one or more arguments of any type to string in the best way possible and prints them to the console. [codeblock] - a = [1, 2, 3] + var a = [1, 2, 3] print("a", "b", a) # Prints ab[1, 2, 3] [/codeblock] [b]Note:[/b] Consider using [method push_error] and [method push_warning] to print error and warning messages instead of [method print]. This distinguishes them from print messages used for debugging purposes, while also displaying a stack trace when an error or warning is printed. @@ -729,7 +741,7 @@ <description> Sets seed for the random number generator. [codeblock] - my_seed = "Godot Rocks" + var my_seed = "Godot Rocks" seed(my_seed.hash()) [/codeblock] </description> @@ -770,7 +782,8 @@ <description> Returns the sine of angle [code]angle_rad[/code] in radians. [codeblock] - sin(0.523599) # Returns 0.5 + sin(0.523599) # Returns 0.5 + sin(deg2rad(90)) # Returns 1.0 [/codeblock] </description> </method> @@ -780,7 +793,7 @@ <description> Returns the hyperbolic sine of [code]x[/code]. [codeblock] - a = log(2.0) # Returns 0.693147 + var a = log(2.0) # Returns 0.693147 sinh(a) # Returns 0.75 [/codeblock] </description> @@ -800,6 +813,8 @@ smoothstep(0, 2, 1.0) # Returns 0.5 smoothstep(0, 2, 2.0) # Returns 1.0 [/codeblock] + Compared to [method ease] with a curve value of [code]-1.6521[/code], [method smoothstep] returns the smoothest possible curve with no sudden changes in the derivative. If you need to perform more advanced transitions, use [Tween] or [AnimationPlayer]. + [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/smoothstep_ease_comparison.png]Comparison between smoothstep() and ease(x, -1.6521) return values[/url] </description> </method> <method name="snapped"> @@ -833,7 +848,7 @@ Returns the position of the first non-zero digit, after the decimal point. Note that the maximum return value is 10, which is a design decision in the implementation. [codeblock] # n is 0 - n = step_decimals(5) + var n = step_decimals(5) # n is 4 n = step_decimals(1.0005) # n is 9 @@ -853,8 +868,8 @@ <description> Converts a formatted string that was returned by [method var2str] to the original value. [codeblock] - a = '{ "a": 1, "b": 2 }' - b = str2var(a) + var a = '{ "a": 1, "b": 2 }' + var b = str2var(a) print(b["a"]) # Prints 1 [/codeblock] </description> @@ -875,7 +890,7 @@ <description> Returns the hyperbolic tangent of [code]x[/code]. [codeblock] - a = log(2.0) # Returns 0.693147 + var a = log(2.0) # Returns 0.693147 tanh(a) # Returns 0.6 [/codeblock] </description> diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 35702070be..e14c2dc110 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -28,6 +28,12 @@ Returns the surface normal of the floor at the last collision point. Only valid after calling [method move_and_slide] and when [method is_on_floor] returns [code]true[/code]. </description> </method> + <method name="get_last_motion" qualifiers="const"> + <return type="Vector2" /> + <description> + Returns the last motion applied to the [CharacterBody2D] during the last call to [method move_and_slide]. The movement can be split into multiple motions when sliding occurs, and this method return the last one, which is useful to retrieve the current direction of the movement. + </description> + </method> <method name="get_last_slide_collision"> <return type="KinematicCollision2D" /> <description> @@ -40,6 +46,18 @@ Returns the linear velocity of the platform at the last collision point. Only valid after calling [method move_and_slide]. </description> </method> + <method name="get_position_delta" qualifiers="const"> + <return type="Vector2" /> + <description> + Returns the travel (position delta) that occurred during the last call to [method move_and_slide]. + </description> + </method> + <method name="get_real_velocity" qualifiers="const"> + <return type="Vector2" /> + <description> + Returns the current real velocity since the last call to [method move_and_slide]. For example, when you climb a slope, you will move diagonally even though the velocity is horizontal. This method returns the diagonal movement, as opposed to [member motion_velocity] which returns the requested velocity. + </description> + </method> <method name="get_slide_collision"> <return type="KinematicCollision2D" /> <argument index="0" name="slide_idx" type="int" /> @@ -68,6 +86,12 @@ Returns the number of times the body collided and changed direction during the last call to [method move_and_slide]. </description> </method> + <method name="get_wall_normal" qualifiers="const"> + <return type="Vector2" /> + <description> + Returns the surface normal of the wall at the last collision point. Only valid after calling [method move_and_slide] and when [method is_on_wall] returns [code]true[/code]. + </description> + </method> <method name="is_on_ceiling" qualifiers="const"> <return type="bool" /> <description> @@ -107,9 +131,9 @@ <method name="move_and_slide"> <return type="bool" /> <description> - Moves the body based on [member linear_velocity]. If the body collides with another, it will slide along the other body (by default only on floor) rather than stop immediately. If the other body is a [CharacterBody2D] or [RigidDynamicBody2D], it will also be affected by the motion of the other body. You can use this to make moving and rotating platforms, or to make nodes push other nodes. + Moves the body based on [member motion_velocity]. If the body collides with another, it will slide along the other body (by default only on floor) rather than stop immediately. If the other body is a [CharacterBody2D] or [RigidDynamicBody2D], it will also be affected by the motion of the other body. You can use this to make moving and rotating platforms, or to make nodes push other nodes. This method should be used in [method Node._physics_process] (or in a method called by [method Node._physics_process]), as it uses the physics step's [code]delta[/code] value automatically in calculations. Otherwise, the simulation will run at an incorrect speed. - Modifies [member linear_velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for detailed information about collisions that occurred, use [method get_slide_collision]. + Modifies [member motion_velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for detailed information about collisions that occurred, use [method get_slide_collision]. When the body touches a moving platform, the platform's velocity is automatically added to the body motion. If a collision occurs due to the platform's motion, it will always be first in the slide collisions. The general behaviour and available properties change according to the [member motion_mode]. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. @@ -138,20 +162,24 @@ As long as the snapping vector is in contact with the ground and the body moves against `up_direction`, the body will remain attached to the surface. Snapping is not applied if the body moves along `up_direction`, so it will be able to detach from the ground when jumping. </member> <member name="floor_stop_on_slope" type="bool" setter="set_floor_stop_on_slope_enabled" getter="is_floor_stop_on_slope_enabled" default="true"> - If [code]true[/code], the body will not slide on floor's slopes when you include gravity in [code]linear_velocity[/code] when calling [method move_and_slide] and the body is standing still. + If [code]true[/code], the body will not slide on slopes when calling [method move_and_slide] when the body is standing still. + If [code]false[/code], the body will slide on floor's slopes when [member motion_velocity] applies a downward force. </member> <member name="free_mode_min_slide_angle" type="float" setter="set_free_mode_min_slide_angle" getter="get_free_mode_min_slide_angle" default="0.261799"> Minimum angle (in radians) where the body is allowed to slide when it encounters a slope. The default value equals 15 degrees. </member> - <member name="linear_velocity" type="Vector2" setter="set_linear_velocity" getter="get_linear_velocity" default="Vector2(0, 0)"> - Current velocity vector in pixels per second, used and modified during calls to [method move_and_slide]. - </member> <member name="max_slides" type="int" setter="set_max_slides" getter="get_max_slides" default="4"> Maximum number of times the body can change direction before it stops when calling [method move_and_slide]. </member> <member name="motion_mode" type="int" setter="set_motion_mode" getter="get_motion_mode" enum="CharacterBody2D.MotionMode" default="0"> Sets the motion mode which defines the behaviour of [method move_and_slide]. See [enum MotionMode] constants for available modes. </member> + <member name="motion_velocity" type="Vector2" setter="set_motion_velocity" getter="get_motion_velocity" default="Vector2(0, 0)"> + Current velocity vector in pixels per second, used and modified during calls to [method move_and_slide]. + </member> + <member name="moving_platform_apply_velocity_on_leave" type="int" setter="set_moving_platform_apply_velocity_on_leave" getter="get_moving_platform_apply_velocity_on_leave" enum="CharacterBody2D.MovingPlatformApplyVelocityOnLeave" default="0"> + Sets the behaviour to apply when you leave a moving platform. By default, to be physically accurate, when you leave the last platform velocity is applied. See [enum MovingPlatformApplyVelocityOnLeave] constants for available behaviour. + </member> <member name="moving_platform_floor_layers" type="int" setter="set_moving_platform_floor_layers" getter="get_moving_platform_floor_layers" default="4294967295"> Collision layers that will be included for detecting floor bodies that will act as moving platforms to be followed by the [CharacterBody2D]. By default, all floor bodies are detected and propagate their velocity. </member> @@ -172,5 +200,14 @@ <constant name="MOTION_MODE_FREE" value="1" enum="MotionMode"> Apply when there is no notion of floor or ceiling. All collisions will be reported as [code]on_wall[/code]. In this mode, when you slide, the speed will always be constant. This mode is suitable for top-down games. </constant> + <constant name="PLATFORM_VEL_ON_LEAVE_ALWAYS" value="0" enum="MovingPlatformApplyVelocityOnLeave"> + Add the last platform velocity to the [member motion_velocity] when you leave a moving platform. + </constant> + <constant name="PLATFORM_VEL_ON_LEAVE_UPWARD_ONLY" value="1" enum="MovingPlatformApplyVelocityOnLeave"> + Add the last platform velocity to the [member motion_velocity] when you leave a moving platform, but any downward motion is ignored. It's useful to keep full jump height even when the platform is moving down. + </constant> + <constant name="PLATFORM_VEL_ON_LEAVE_NEVER" value="2" enum="MovingPlatformApplyVelocityOnLeave"> + Do nothing when leaving a platform. + </constant> </constants> </class> diff --git a/doc/classes/Dictionary.xml b/doc/classes/Dictionary.xml index 0575ea3eef..2eb75d48a3 100644 --- a/doc/classes/Dictionary.xml +++ b/doc/classes/Dictionary.xml @@ -213,7 +213,8 @@ <return type="bool" /> <argument index="0" name="key" type="Variant" /> <description> - Erase a dictionary key/value pair by key. Returns [code]true[/code] if the given key was present in the dictionary, [code]false[/code] otherwise. Does not erase elements while iterating over the dictionary. + Erase a dictionary key/value pair by key. Returns [code]true[/code] if the given key was present in the dictionary, [code]false[/code] otherwise. + [b]Note:[/b] Don't erase elements while iterating over the dictionary. You can iterate over the [method keys] array instead. </description> </method> <method name="get" qualifiers="const"> diff --git a/doc/classes/LineEdit.xml b/doc/classes/LineEdit.xml index 834b5a41db..83e3f5b05a 100644 --- a/doc/classes/LineEdit.xml +++ b/doc/classes/LineEdit.xml @@ -82,6 +82,24 @@ Returns the scroll offset due to [member caret_column], as a number of characters. </description> </method> + <method name="get_selection_from_column" qualifiers="const"> + <return type="int" /> + <description> + Returns the selection begin column. + </description> + </method> + <method name="get_selection_to_column" qualifiers="const"> + <return type="int" /> + <description> + Returns the selection end column. + </description> + </method> + <method name="has_selection" qualifiers="const"> + <return type="bool" /> + <description> + Returns [code]true[/code] if the user has selected text. + </description> + </method> <method name="insert_text_at_caret"> <return type="void" /> <argument index="0" name="text" type="String" /> diff --git a/doc/classes/MultiplayerPeerExtension.xml b/doc/classes/MultiplayerPeerExtension.xml index d9c173a4a1..46f9b22758 100644 --- a/doc/classes/MultiplayerPeerExtension.xml +++ b/doc/classes/MultiplayerPeerExtension.xml @@ -24,7 +24,7 @@ </method> <method name="_get_packet" qualifiers="virtual"> <return type="int" /> - <argument index="0" name="r_buffer" type="const void*" /> + <argument index="0" name="r_buffer" type="const uint8_t **" /> <argument index="1" name="r_buffer_size" type="int32_t*" /> <description> </description> @@ -66,7 +66,7 @@ </method> <method name="_put_packet" qualifiers="virtual"> <return type="int" /> - <argument index="0" name="p_buffer" type="const void*" /> + <argument index="0" name="p_buffer" type="const uint8_t*" /> <argument index="1" name="p_buffer_size" type="int" /> <description> </description> diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index 608d76cd9f..b4edcf49f4 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -700,9 +700,6 @@ <member name="custom_multiplayer" type="MultiplayerAPI" setter="set_custom_multiplayer" getter="get_custom_multiplayer"> The override to the default [MultiplayerAPI]. Set to [code]null[/code] to use the default [SceneTree] one. </member> - <member name="filename" type="String" setter="set_filename" getter="get_filename"> - When a scene is instantiated from a file, its topmost node contains the filename from which it was loaded. - </member> <member name="multiplayer" type="MultiplayerAPI" setter="" getter="get_multiplayer"> The [MultiplayerAPI] instance associated with this node. Either the [member custom_multiplayer], or the default SceneTree one (if inside tree). </member> @@ -719,6 +716,9 @@ <member name="process_priority" type="int" setter="set_process_priority" getter="get_process_priority" default="0"> The node's priority in the execution order of the enabled processing callbacks (i.e. [constant NOTIFICATION_PROCESS], [constant NOTIFICATION_PHYSICS_PROCESS] and their internal counterparts). Nodes whose process priority value is [i]lower[/i] will have their processing callbacks executed first. </member> + <member name="scene_file_path" type="String" setter="set_scene_file_path" getter="get_scene_file_path"> + If a scene is instantiated from a file, its topmost node contains the absolute file path from which it was loaded in [member scene_file_path] (e.g. [code]res://levels/1.tscn[/code]). Otherwise, [member scene_file_path] is set to an empty string. + </member> </members> <signals> <signal name="ready"> diff --git a/doc/classes/PacketPeerExtension.xml b/doc/classes/PacketPeerExtension.xml index 6804053484..f6b925eb30 100644 --- a/doc/classes/PacketPeerExtension.xml +++ b/doc/classes/PacketPeerExtension.xml @@ -19,14 +19,14 @@ </method> <method name="_get_packet" qualifiers="virtual"> <return type="int" /> - <argument index="0" name="r_buffer" type="const void*" /> + <argument index="0" name="r_buffer" type="const uint8_t **" /> <argument index="1" name="r_buffer_size" type="int32_t*" /> <description> </description> </method> <method name="_put_packet" qualifiers="virtual"> <return type="int" /> - <argument index="0" name="p_buffer" type="const void*" /> + <argument index="0" name="p_buffer" type="const uint8_t*" /> <argument index="1" name="p_buffer_size" type="int" /> <description> </description> diff --git a/doc/classes/PhysicsServer2D.xml b/doc/classes/PhysicsServer2D.xml index b604503163..791a04e4c2 100644 --- a/doc/classes/PhysicsServer2D.xml +++ b/doc/classes/PhysicsServer2D.xml @@ -926,8 +926,8 @@ <constant name="BODY_MODE_DYNAMIC" value="2" enum="BodyMode"> Constant for dynamic bodies. In this mode, a body can be pushed by other bodies and has forces applied. </constant> - <constant name="BODY_MODE_DYNAMIC_LOCKED" value="3" enum="BodyMode"> - Constant for locked dynamic bodies. In this mode, a body is dynamic but can not rotate, and only its linear velocity is affected by external forces. + <constant name="BODY_MODE_DYNAMIC_LINEAR" value="3" enum="BodyMode"> + Constant for linear dynamic bodies. In this mode, a body is dynamic but can not rotate, and only its linear velocity is affected by external forces. </constant> <constant name="BODY_PARAM_BOUNCE" value="0" enum="BodyParameter"> Constant to set/get a body's bounce factor. diff --git a/doc/classes/PhysicsServer3D.xml b/doc/classes/PhysicsServer3D.xml index 30812845e2..1d1ca54dbb 100644 --- a/doc/classes/PhysicsServer3D.xml +++ b/doc/classes/PhysicsServer3D.xml @@ -1278,8 +1278,8 @@ <constant name="BODY_MODE_DYNAMIC" value="2" enum="BodyMode"> Constant for dynamic bodies. In this mode, a body can be pushed by other bodies and has forces applied. </constant> - <constant name="BODY_MODE_DYNAMIC_LOCKED" value="3" enum="BodyMode"> - Constant for locked dynamic bodies. In this mode, a body is dynamic but can not rotate, and only its linear velocity is affected by external forces. + <constant name="BODY_MODE_DYNAMIC_LINEAR" value="3" enum="BodyMode"> + Constant for linear dynamic bodies. In this mode, a body is dynamic but can not rotate, and only its linear velocity is affected by external forces. </constant> <constant name="BODY_PARAM_BOUNCE" value="0" enum="BodyParameter"> Constant to set/get a body's bounce factor. diff --git a/doc/classes/RigidDynamicBody2D.xml b/doc/classes/RigidDynamicBody2D.xml index 059379242b..9baed392eb 100644 --- a/doc/classes/RigidDynamicBody2D.xml +++ b/doc/classes/RigidDynamicBody2D.xml @@ -5,11 +5,10 @@ </brief_description> <description> This node implements simulated 2D physics. You do not control a RigidDynamicBody2D directly. Instead, you apply forces to it (gravity, impulses, etc.) and the physics simulation calculates the resulting movement based on its mass, friction, and other physical properties. - A RigidDynamicBody2D has 4 behavior [member mode]s: Dynamic, Static, DynamicLocked, and Kinematic. + You can switch the body's behavior using [member lock_rotation], [member freeze], and [member freeze_mode]. [b]Note:[/b] You should not change a RigidDynamicBody2D's [code]position[/code] or [code]linear_velocity[/code] every frame or even very often. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state. Please also keep in mind that physics bodies manage their own transform which overwrites the ones you set. So any direct or indirect transformation (including scaling of the node or its parent) will be visible in the editor only, and immediately reset at runtime. If you need to override the default physics behavior or add a transformation at runtime, you can write a custom force integration. See [member custom_integrator]. - The center of mass is always located at the node's origin without taking into account the [CollisionShape2D] centroid offsets. </description> <tutorials> <link title="2D Physics Platformer Demo">https://godotengine.org/asset-library/asset/119</link> @@ -120,6 +119,15 @@ <member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator" default="false"> If [code]true[/code], internal force integration is disabled for this body. Aside from collision response, the body will only move as determined by the [method _integrate_forces] function. </member> + <member name="freeze" type="bool" setter="set_freeze_enabled" getter="is_freeze_enabled" default="false"> + If [code]true[/code], the body is frozen. Gravity and forces are not applied anymore. + See [member freeze_mode] to set the body's behavior when frozen. + For a body that is always frozen, use [StaticBody2D] or [AnimatableBody2D] instead. + </member> + <member name="freeze_mode" type="int" setter="set_freeze_mode" getter="get_freeze_mode" enum="RigidDynamicBody2D.FreezeMode" default="0"> + The body's freeze mode. Can be used to set the body's behavior when [member freeze] is enabled. See [enum FreezeMode] for possible values. + For a body that is always frozen, use [StaticBody2D] or [AnimatableBody2D] instead. + </member> <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0"> Multiplies the gravity applied to the body. The body's gravity is calculated from the [b]Default Gravity[/b] value in [b]Project > Project Settings > Physics > 2d[/b] and/or any additional gravity vector applied by [Area2D]s. </member> @@ -134,13 +142,12 @@ <member name="linear_velocity" type="Vector2" setter="set_linear_velocity" getter="get_linear_velocity" default="Vector2(0, 0)"> The body's linear velocity. </member> + <member name="lock_rotation" type="bool" setter="set_lock_rotation_enabled" getter="is_lock_rotation_enabled" default="false"> + If [code]true[/code], the body cannot rotate. Gravity and forces only apply linear movement. + </member> <member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0"> The body's mass. </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidDynamicBody2D.Mode" default="0"> - The body's mode. See [enum Mode] for possible values. - For a body that uses only Static or Kinematic mode, use [StaticBody2D] or [AnimatableBody2D] instead. - </member> <member name="physics_material_override" type="PhysicsMaterial" setter="set_physics_material_override" getter="get_physics_material_override"> The physics material override for the body. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one. @@ -198,17 +205,11 @@ </signal> </signals> <constants> - <constant name="MODE_DYNAMIC" value="0" enum="Mode"> - Dynamic body mode. This is the default mode of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. - </constant> - <constant name="MODE_STATIC" value="1" enum="Mode"> - Static body mode. The body behaves like a [StaticBody2D], and must be moved by code. - </constant> - <constant name="MODE_DYNAMIC_LOCKED" value="2" enum="Mode"> - Locked dynamic body mode. Similar to [constant MODE_DYNAMIC], but the body can not rotate. + <constant name="FREEZE_MODE_STATIC" value="0" enum="FreezeMode"> + Static body freeze mode (default). The body is not affected by gravity and forces. It can be only moved by user code and doesn't collide with other bodies along its path. </constant> - <constant name="MODE_KINEMATIC" value="3" enum="Mode"> - Kinematic body mode. The body behaves like a [AnimatableBody2D], and must be moved by code. + <constant name="FREEZE_MODE_KINEMATIC" value="1" enum="FreezeMode"> + Kinematic body freeze mode. Similar to [constant FREEZE_MODE_STATIC], but collides with other bodies along its path when moved. Useful for a frozen body that needs to be animated. </constant> <constant name="CENTER_OF_MASS_MODE_AUTO" value="0" enum="CenterOfMassMode"> In this mode, the body's center of mass is calculated automatically based on its shapes. diff --git a/doc/classes/RigidDynamicBody3D.xml b/doc/classes/RigidDynamicBody3D.xml index 9b6bcd840b..7d1c7fecfa 100644 --- a/doc/classes/RigidDynamicBody3D.xml +++ b/doc/classes/RigidDynamicBody3D.xml @@ -5,10 +5,9 @@ </brief_description> <description> This is the node that implements full 3D physics. This means that you do not control a RigidDynamicBody3D directly. Instead, you can apply forces to it (gravity, impulses, etc.), and the physics simulation will calculate the resulting movement, collision, bouncing, rotating, etc. - A RigidDynamicBody3D has 4 behavior [member mode]s: Dynamic, Static, DynamicLocked, and Kinematic. + You can switch the body's behavior using [member lock_rotation], [member freeze], and [member freeze_mode]. [b]Note:[/b] Don't change a RigidDynamicBody3D's position every frame or very often. Sporadic changes work fine, but physics runs at a different granularity (fixed Hz) than usual rendering (process callback) and maybe even in a separate thread, so changing this from a process loop may result in strange behavior. If you need to directly affect the body's state, use [method _integrate_forces], which allows you to directly access the physics state. If you need to override the default physics behavior, you can write a custom force integration function. See [member custom_integrator]. - With Bullet physics (the default), the center of mass is the RigidDynamicBody3D center. With GodotPhysics, the center of mass is the average of the [CollisionShape3D] centers. </description> <tutorials> <link title="Physics introduction">https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link> @@ -123,6 +122,15 @@ <member name="custom_integrator" type="bool" setter="set_use_custom_integrator" getter="is_using_custom_integrator" default="false"> If [code]true[/code], internal force integration will be disabled (like gravity or air friction) for this body. Other than collision response, the body will only move as determined by the [method _integrate_forces] function, if defined. </member> + <member name="freeze" type="bool" setter="set_freeze_enabled" getter="is_freeze_enabled" default="false"> + If [code]true[/code], the body is frozen. Gravity and forces are not applied anymore. + See [member freeze_mode] to set the body's behavior when frozen. + For a body that is always frozen, use [StaticBody3D] or [AnimatableBody3D] instead. + </member> + <member name="freeze_mode" type="int" setter="set_freeze_mode" getter="get_freeze_mode" enum="RigidDynamicBody3D.FreezeMode" default="0"> + The body's freeze mode. Can be used to set the body's behavior when [member freeze] is enabled. See [enum FreezeMode] for possible values. + For a body that is always frozen, use [StaticBody3D] or [AnimatableBody3D] instead. + </member> <member name="gravity_scale" type="float" setter="set_gravity_scale" getter="get_gravity_scale" default="1.0"> This is multiplied by the global 3D gravity setting found in [b]Project > Project Settings > Physics > 3d[/b] to produce RigidDynamicBody3D's gravity. For example, a value of 1 will be normal gravity, 2 will apply double gravity, and 0.5 will apply half gravity to this object. </member> @@ -137,13 +145,12 @@ <member name="linear_velocity" type="Vector3" setter="set_linear_velocity" getter="get_linear_velocity" default="Vector3(0, 0, 0)"> The body's linear velocity. Can be used sporadically, but [b]don't set this every frame[/b], because physics may run in another thread and runs at a different granularity. Use [method _integrate_forces] as your process loop for precise control of the body state. </member> + <member name="lock_rotation" type="bool" setter="set_lock_rotation_enabled" getter="is_lock_rotation_enabled" default="false"> + If [code]true[/code], the body cannot rotate. Gravity and forces only apply linear movement. + </member> <member name="mass" type="float" setter="set_mass" getter="get_mass" default="1.0"> The body's mass. </member> - <member name="mode" type="int" setter="set_mode" getter="get_mode" enum="RigidDynamicBody3D.Mode" default="0"> - The body's mode. See [enum Mode] for possible values. - For a body that uses only Static or Kinematic mode, use [StaticBody3D] or [AnimatableBody3D] instead. - </member> <member name="physics_material_override" type="PhysicsMaterial" setter="set_physics_material_override" getter="get_physics_material_override"> The physics material override for the body. If a material is assigned to this property, it will be used instead of any other physics material, such as an inherited one. @@ -203,17 +210,11 @@ </signal> </signals> <constants> - <constant name="MODE_DYNAMIC" value="0" enum="Mode"> - Dynamic body mode. This is the default mode of a rigid body. It is affected by forces, and can move, rotate, and be affected by user code. - </constant> - <constant name="MODE_STATIC" value="1" enum="Mode"> - Static body mode. The body behaves like a [StaticBody3D], and can only move by user code. - </constant> - <constant name="MODE_DYNAMIC_LOCKED" value="2" enum="Mode"> - Locked dynamic body mode. Similar to [constant MODE_DYNAMIC], but the body can not rotate. + <constant name="FREEZE_MODE_STATIC" value="0" enum="FreezeMode"> + Static body freeze mode (default). The body is not affected by gravity and forces. It can be only moved by user code and doesn't collide with other bodies along its path. </constant> - <constant name="MODE_KINEMATIC" value="3" enum="Mode"> - Kinematic body mode. The body behaves like a [AnimatableBody3D], and can only move by user code. + <constant name="FREEZE_MODE_KINEMATIC" value="1" enum="FreezeMode"> + Kinematic body freeze mode. Similar to [constant FREEZE_MODE_STATIC], but collides with other bodies along its path when moved. Useful for a frozen body that needs to be animated. </constant> <constant name="CENTER_OF_MASS_MODE_AUTO" value="0" enum="CenterOfMassMode"> In this mode, the body's center of mass is calculated automatically based on its shapes. diff --git a/doc/classes/StreamPeerExtension.xml b/doc/classes/StreamPeerExtension.xml index 93fda8cf5d..ceb9486a33 100644 --- a/doc/classes/StreamPeerExtension.xml +++ b/doc/classes/StreamPeerExtension.xml @@ -30,7 +30,7 @@ </method> <method name="_put_data" qualifiers="virtual"> <return type="int" /> - <argument index="0" name="p_data" type="const void*" /> + <argument index="0" name="p_data" type="const uint8_t*" /> <argument index="1" name="p_bytes" type="int" /> <argument index="2" name="r_sent" type="int32_t*" /> <description> @@ -38,7 +38,7 @@ </method> <method name="_put_partial_data" qualifiers="virtual"> <return type="int" /> - <argument index="0" name="p_data" type="const void*" /> + <argument index="0" name="p_data" type="const uint8_t*" /> <argument index="1" name="p_bytes" type="int" /> <argument index="2" name="r_sent" type="int32_t*" /> <description> diff --git a/doc/classes/TileData.xml b/doc/classes/TileData.xml index 0d3282c6d3..81c5743ccc 100644 --- a/doc/classes/TileData.xml +++ b/doc/classes/TileData.xml @@ -37,6 +37,20 @@ Returns how many polygons the tile has for TileSet physics layer with index [code]layer_id[/code]. </description> </method> + <method name="get_constant_angular_velocity" qualifiers="const"> + <return type="float" /> + <argument index="0" name="layer_id" type="int" /> + <description> + Returns the constant angular velocity applied to objects colliding with this tile. + </description> + </method> + <method name="get_constant_linear_velocity" qualifiers="const"> + <return type="Vector2" /> + <argument index="0" name="layer_id" type="int" /> + <description> + Returns the constant linear velocity applied to objects colliding with this tile. + </description> + </method> <method name="get_custom_data" qualifiers="const"> <return type="Variant" /> <argument index="0" name="layer_name" type="String" /> @@ -123,6 +137,22 @@ Sets the polygons count for TileSet physics layer with index [code]layer_id[/code]. </description> </method> + <method name="set_constant_angular_velocity"> + <return type="void" /> + <argument index="0" name="layer_id" type="int" /> + <argument index="1" name="velocity" type="float" /> + <description> + Sets the constant angular velocity. This does not rotate the tile. This angular velocity is applied to objects colliding with this tile. + </description> + </method> + <method name="set_constant_linear_velocity"> + <return type="void" /> + <argument index="0" name="layer_id" type="int" /> + <argument index="1" name="velocity" type="Vector2" /> + <description> + Sets the constant linear velocity. This does not move the tile. This linear velocity is applied to objects colliding with this tile. This is useful to create conveyor belts. + </description> + </method> <method name="set_custom_data"> <return type="void" /> <argument index="0" name="layer_name" type="String" /> diff --git a/doc/classes/TileMap.xml b/doc/classes/TileMap.xml index 4621d138ac..e5fe823be6 100644 --- a/doc/classes/TileMap.xml +++ b/doc/classes/TileMap.xml @@ -29,6 +29,13 @@ Clears all cells. </description> </method> + <method name="clear_layer"> + <return type="void" /> + <argument index="0" name="layer" type="int" /> + <description> + Clears all cells on the given layer. + </description> + </method> <method name="fix_invalid_tiles"> <return type="void" /> <description> @@ -62,6 +69,13 @@ Returns the tile source ID of the cell on layer [code]layer[/code] at coordinates [code]coords[/code]. If [code]use_proxies[/code] is [code]false[/code], ignores the [TileSet]'s tile proxies, returning the raw alternative identifier. See [method TileSet.map_tile_proxy]. </description> </method> + <method name="get_coords_for_body_rid"> + <return type="Vector2i" /> + <argument index="0" name="body" type="RID" /> + <description> + Returns the coodinates of the tile for given physics body RID. Such RID can be retrieved from [member KinematicCollision2D.collider_rid], when colliding with a tile. + </description> + </method> <method name="get_layer_name" qualifiers="const"> <return type="String" /> <argument index="0" name="layer" type="int" /> @@ -220,6 +234,10 @@ <member name="cell_quadrant_size" type="int" setter="set_quadrant_size" getter="get_quadrant_size" default="16"> The TileMap's quadrant size. Optimizes drawing by batching, using chunks of this size. </member> + <member name="collision_animatable" type="bool" setter="set_collision_animatable" getter="is_collision_animatable" default="false"> + If enabled, the TileMap will see its collisions synced to the physics tick and change its collision type from static to kinematic. This is required to create TileMap-based moving platform. + [b]Note:[/b] Enabling [code]collision_animatable[/code] may have a small performance impact, only do it if the TileMap is moving and has colliding tiles. + </member> <member name="collision_visibility_mode" type="int" setter="set_collision_visibility_mode" getter="get_collision_visibility_mode" enum="TileMap.VisibilityMode" default="0"> Show or hide the TileMap's collision shapes. If set to [code]VISIBILITY_MODE_DEFAULT[/code], this depends on the show collision debug settings. </member> diff --git a/doc/classes/Translation.xml b/doc/classes/Translation.xml index c27d6f5667..2a0695d42e 100644 --- a/doc/classes/Translation.xml +++ b/doc/classes/Translation.xml @@ -11,6 +11,24 @@ <link title="Locales">https://docs.godotengine.org/en/latest/tutorials/i18n/locales.html</link> </tutorials> <methods> + <method name="_get_message" qualifiers="virtual const"> + <return type="StringName" /> + <argument index="0" name="src_message" type="StringName" /> + <argument index="1" name="context" type="StringName" /> + <description> + Virtual method to override [method get_message]. + </description> + </method> + <method name="_get_plural_message" qualifiers="virtual const"> + <return type="StringName" /> + <argument index="0" name="src_message" type="StringName" /> + <argument index="1" name="src_plural_message" type="StringName" /> + <argument index="2" name="n" type="int" /> + <argument index="3" name="context" type="StringName" /> + <description> + Virtual method to override [method get_plural_message]. + </description> + </method> <method name="add_message"> <return type="void" /> <argument index="0" name="src_message" type="StringName" /> |