From d2704fb3edfe9771a8325e45c8d14ad26c248c0e Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 10:53:12 -0300 Subject: [PATCH 1/8] Add optional delta parameter to move_and_slide This overrides the implicit delta derived from context that is currently being used. If not passed, the method functions as it normally does. This change allows finer control over the method's behavior without sacrificing ease of use. --- doc/classes/CharacterBody2D.xml | 1 + doc/classes/CharacterBody3D.xml | 1 + scene/2d/physics_body_2d.cpp | 11 +++++++---- scene/2d/physics_body_2d.h | 2 +- scene/3d/physics_body_3d.cpp | 11 +++++++---- scene/3d/physics_body_3d.h | 2 +- 6 files changed, 18 insertions(+), 10 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index b66a01a282cb..3e55bd5c3099 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -141,6 +141,7 @@ 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 behavior and available properties change according to the [member motion_mode]. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. + By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overriden by passing a custom [param delta] value to the method. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 2382c77a12cc..9b2c43e810d7 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -132,6 +132,7 @@ Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more 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. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. + By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overriden by passing a custom [param delta] value to the method. diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index baa3b0bb9028..71f5d8e47e92 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1100,9 +1100,12 @@ void RigidBody2D::_reload_physics_characteristics() { // So, if you pass 45 as limit, avoid numerical precision errors when angle is 45. #define FLOOR_ANGLE_THRESHOLD 0.01 -bool CharacterBody2D::move_and_slide() { - // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. - double delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); +bool CharacterBody2D::move_and_slide(double delta) { + // Negative delta means no value was passed (default is -1), so we infer it from context + if (delta < 0) { + // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. + delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); + } Vector2 current_platform_velocity = platform_velocity; Transform2D gt = get_global_transform(); @@ -1713,7 +1716,7 @@ void CharacterBody2D::_notification(int p_what) { } void CharacterBody2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("move_and_slide"), &CharacterBody2D::move_and_slide); + ClassDB::bind_method(D_METHOD("move_and_slide", "delta"), &CharacterBody2D::move_and_slide); ClassDB::bind_method(D_METHOD("apply_floor_snap"), &CharacterBody2D::apply_floor_snap); ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &CharacterBody2D::set_velocity); diff --git a/scene/2d/physics_body_2d.h b/scene/2d/physics_body_2d.h index f5448ead4082..d457aa6163a0 100644 --- a/scene/2d/physics_body_2d.h +++ b/scene/2d/physics_body_2d.h @@ -338,7 +338,7 @@ class CharacterBody2D : public PhysicsBody2D { PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY, PLATFORM_ON_LEAVE_DO_NOTHING, }; - bool move_and_slide(); + bool move_and_slide(double delta = -1); void apply_floor_snap(); const Vector2 &get_velocity() const; diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index a5f5ae6e6153..92acddd855ec 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1164,9 +1164,12 @@ void RigidBody3D::_reload_physics_characteristics() { //so, if you pass 45 as limit, avoid numerical precision errors when angle is 45. #define FLOOR_ANGLE_THRESHOLD 0.01 -bool CharacterBody3D::move_and_slide() { - // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky - double delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); +bool CharacterBody3D::move_and_slide(double delta) { + // Negative delta means no value was passed (default is -1), so we infer it from context + if (delta < 0) { + // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. + delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); + } for (int i = 0; i < 3; i++) { if (locked_axis & (1 << i)) { @@ -1964,7 +1967,7 @@ void CharacterBody3D::_notification(int p_what) { } void CharacterBody3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("move_and_slide"), &CharacterBody3D::move_and_slide); + ClassDB::bind_method(D_METHOD("move_and_slide", "delta"), &CharacterBody3D::move_and_slide); ClassDB::bind_method(D_METHOD("apply_floor_snap"), &CharacterBody3D::apply_floor_snap); ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &CharacterBody3D::set_velocity); diff --git a/scene/3d/physics_body_3d.h b/scene/3d/physics_body_3d.h index 9798fc48450c..9894cc646c16 100644 --- a/scene/3d/physics_body_3d.h +++ b/scene/3d/physics_body_3d.h @@ -355,7 +355,7 @@ class CharacterBody3D : public PhysicsBody3D { PLATFORM_ON_LEAVE_ADD_UPWARD_VELOCITY, PLATFORM_ON_LEAVE_DO_NOTHING, }; - bool move_and_slide(); + bool move_and_slide(double delta = -1); void apply_floor_snap(); const Vector3 &get_velocity() const; From 607ac38a3d17eca2bf4fa5db4ab4de648f9d5e38 Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 11:10:09 -0300 Subject: [PATCH 2/8] Generate missing docs --- doc/classes/CharacterBody2D.xml | 1 + doc/classes/CharacterBody3D.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 3e55bd5c3099..101e456b3590 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -135,6 +135,7 @@ + Moves the body based on [member 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 [RigidBody2D], 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. Modifies [member 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]. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 9b2c43e810d7..9bbc0ae1c664 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -127,6 +127,7 @@ + Moves the body based on [member velocity]. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [CharacterBody3D] or [RigidBody3D], 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. Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more detailed information about collisions that occurred, use [method get_slide_collision]. From 8f954465fd841493ab09090b805005393d53d0ca Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 11:19:10 -0300 Subject: [PATCH 3/8] Add default value to documentation and ClassDB --- doc/classes/CharacterBody2D.xml | 2 +- doc/classes/CharacterBody3D.xml | 2 +- scene/2d/physics_body_2d.cpp | 2 +- scene/3d/physics_body_3d.cpp | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 101e456b3590..5f8b99202551 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -135,7 +135,7 @@ - + Moves the body based on [member 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 [RigidBody2D], 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. Modifies [member 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]. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 9bbc0ae1c664..18d3324308ce 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -127,7 +127,7 @@ - + Moves the body based on [member velocity]. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [CharacterBody3D] or [RigidBody3D], 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. Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more detailed information about collisions that occurred, use [method get_slide_collision]. diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 71f5d8e47e92..f11adac7ec5d 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1716,7 +1716,7 @@ void CharacterBody2D::_notification(int p_what) { } void CharacterBody2D::_bind_methods() { - ClassDB::bind_method(D_METHOD("move_and_slide", "delta"), &CharacterBody2D::move_and_slide); + ClassDB::bind_method(D_METHOD("move_and_slide", "delta"), &CharacterBody2D::move_and_slide, DEFVAL(-1.0)); ClassDB::bind_method(D_METHOD("apply_floor_snap"), &CharacterBody2D::apply_floor_snap); ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &CharacterBody2D::set_velocity); diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 92acddd855ec..ed16b3f9ced0 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1967,7 +1967,7 @@ void CharacterBody3D::_notification(int p_what) { } void CharacterBody3D::_bind_methods() { - ClassDB::bind_method(D_METHOD("move_and_slide", "delta"), &CharacterBody3D::move_and_slide); + ClassDB::bind_method(D_METHOD("move_and_slide", "delta"), &CharacterBody3D::move_and_slide, DEFVAL(-1.0)); ClassDB::bind_method(D_METHOD("apply_floor_snap"), &CharacterBody3D::apply_floor_snap); ClassDB::bind_method(D_METHOD("set_velocity", "velocity"), &CharacterBody3D::set_velocity); From 0fe128f9cfd895cc022f39038849c28224a9cbb6 Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 11:27:37 -0300 Subject: [PATCH 4/8] Ignore non-positive delta values Also add a note to the docs about the behavior when delta is <= 0 --- doc/classes/CharacterBody2D.xml | 1 + doc/classes/CharacterBody3D.xml | 1 + scene/2d/physics_body_2d.cpp | 2 +- scene/3d/physics_body_3d.cpp | 2 +- 4 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 5f8b99202551..0164863ea80f 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -143,6 +143,7 @@ The general behavior and available properties change according to the [member motion_mode]. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overriden by passing a custom [param delta] value to the method. + [b]Note:[/b] [param delta] must be a positive number. Zero or negative values will be ignored. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 18d3324308ce..67769ecc755a 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -134,6 +134,7 @@ 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. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overriden by passing a custom [param delta] value to the method. + [b]Note:[/b] [param delta] must be a positive number. Zero or negative values will treated as if no value was passed. diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index f11adac7ec5d..563e90fed1b8 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1102,7 +1102,7 @@ void RigidBody2D::_reload_physics_characteristics() { bool CharacterBody2D::move_and_slide(double delta) { // Negative delta means no value was passed (default is -1), so we infer it from context - if (delta < 0) { + if (delta <= 0) { // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); } diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index ed16b3f9ced0..e77914240ef1 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1166,7 +1166,7 @@ void RigidBody3D::_reload_physics_characteristics() { bool CharacterBody3D::move_and_slide(double delta) { // Negative delta means no value was passed (default is -1), so we infer it from context - if (delta < 0) { + if (delta <= 0) { // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); } From 01bd74b7306eb1b7e56f77ee6f1250190bfe5b4d Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 11:40:13 -0300 Subject: [PATCH 5/8] Improve delta check to include NaN case Also fix documentation of delta param --- doc/classes/CharacterBody2D.xml | 2 +- doc/classes/CharacterBody3D.xml | 2 +- scene/2d/physics_body_2d.cpp | 4 ++-- scene/3d/physics_body_3d.cpp | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 0164863ea80f..84a1835036d3 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -135,7 +135,7 @@ - + Moves the body based on [member 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 [RigidBody2D], 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. Modifies [member 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]. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 67769ecc755a..bf643bba0a07 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -127,7 +127,7 @@ - + Moves the body based on [member velocity]. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [CharacterBody3D] or [RigidBody3D], 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. Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more detailed information about collisions that occurred, use [method get_slide_collision]. diff --git a/scene/2d/physics_body_2d.cpp b/scene/2d/physics_body_2d.cpp index 563e90fed1b8..c7c5aafa46f1 100644 --- a/scene/2d/physics_body_2d.cpp +++ b/scene/2d/physics_body_2d.cpp @@ -1101,8 +1101,8 @@ void RigidBody2D::_reload_physics_characteristics() { #define FLOOR_ANGLE_THRESHOLD 0.01 bool CharacterBody2D::move_and_slide(double delta) { - // Negative delta means no value was passed (default is -1), so we infer it from context - if (delta <= 0) { + // Non-positive delta value means nothing was passed (default is -1) or an invalid value, so we infer it from context + if (!(delta > 0)) { // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); } diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index e77914240ef1..2b3158dd3feb 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1165,8 +1165,8 @@ void RigidBody3D::_reload_physics_characteristics() { #define FLOOR_ANGLE_THRESHOLD 0.01 bool CharacterBody3D::move_and_slide(double delta) { - // Negative delta means no value was passed (default is -1), so we infer it from context - if (delta <= 0) { + // Non-positive delta value means nothing was passed (default is -1) or an invalid value, so we infer it from context + if (!(delta > 0)) { // Hack in order to work with calling from _process as well as from _physics_process; calling from thread is risky. delta = Engine::get_singleton()->is_in_physics_frame() ? get_physics_process_delta_time() : get_process_delta_time(); } From c752ea4dcf1d830f006fe257692ccd58ee6dd2f1 Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 11:53:05 -0300 Subject: [PATCH 6/8] Spellcheck documentation --- doc/classes/CharacterBody2D.xml | 2 +- doc/classes/CharacterBody3D.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 84a1835036d3..9540a68da5b2 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -142,7 +142,7 @@ 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 behavior and available properties change according to the [member motion_mode]. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. - By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overriden by passing a custom [param delta] value to the method. + By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overridden by passing a custom [param delta] value to the method. [b]Note:[/b] [param delta] must be a positive number. Zero or negative values will be ignored. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index bf643bba0a07..942a3c815237 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -133,7 +133,7 @@ Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more 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. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. - By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overriden by passing a custom [param delta] value to the method. + By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overridden by passing a custom [param delta] value to the method. [b]Note:[/b] [param delta] must be a positive number. Zero or negative values will treated as if no value was passed. From 7352bb57b2eb8e10fc7c7e532c5a11a14a04cb4c Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Thu, 9 Nov 2023 12:03:30 -0300 Subject: [PATCH 7/8] Add trailing zeroes to default values in docs --- doc/classes/CharacterBody2D.xml | 2 +- doc/classes/CharacterBody3D.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 9540a68da5b2..2909981c709c 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -135,7 +135,7 @@ - + Moves the body based on [member 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 [RigidBody2D], 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. Modifies [member 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]. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 942a3c815237..22c23f7a3257 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -127,7 +127,7 @@ - + Moves the body based on [member velocity]. If the body collides with another, it will slide along the other body rather than stop immediately. If the other body is a [CharacterBody3D] or [RigidBody3D], 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. Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more detailed information about collisions that occurred, use [method get_slide_collision]. From 37f93a12c288c05da2c6a9d26bfa6d19602e4614 Mon Sep 17 00:00:00 2001 From: Jeremias Diaz Date: Fri, 10 Nov 2023 09:38:26 -0300 Subject: [PATCH 8/8] Fix typo in docs --- doc/classes/CharacterBody2D.xml | 2 +- doc/classes/CharacterBody3D.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/classes/CharacterBody2D.xml b/doc/classes/CharacterBody2D.xml index 2909981c709c..fab9e1c66adf 100644 --- a/doc/classes/CharacterBody2D.xml +++ b/doc/classes/CharacterBody2D.xml @@ -142,7 +142,7 @@ 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 behavior and available properties change according to the [member motion_mode]. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. - By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overridden by passing a custom [param delta] value to the method. + By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]physics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overridden by passing a custom [param delta] value to the method. [b]Note:[/b] [param delta] must be a positive number. Zero or negative values will be ignored. diff --git a/doc/classes/CharacterBody3D.xml b/doc/classes/CharacterBody3D.xml index 22c23f7a3257..69452cc33154 100644 --- a/doc/classes/CharacterBody3D.xml +++ b/doc/classes/CharacterBody3D.xml @@ -133,7 +133,7 @@ Modifies [member velocity] if a slide collision occurred. To get the latest collision call [method get_last_slide_collision], for more 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. Returns [code]true[/code] if the body collided, otherwise, returns [code]false[/code]. - By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]pyhsics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overridden by passing a custom [param delta] value to the method. + By default, the time delta used for motion depends on the context the method is called from. When called from [method Node._physics_process], the delta is the time passed between the current and last [i]physics[/i] frame. When called from [method Node._process], the delta is the time passed between the current and last [i]render[/i] frame. This can be overridden by passing a custom [param delta] value to the method. [b]Note:[/b] [param delta] must be a positive number. Zero or negative values will treated as if no value was passed.