summaryrefslogtreecommitdiff
path: root/scene/3d
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2022-09-19 15:39:55 +0200
committerRémi Verschelde <rverschelde@gmail.com>2022-09-19 15:39:55 +0200
commit40a7fb238de94bc61acf68b535d9ef36d7ceeedd (patch)
tree2370572628f8f33dcbe48786daa4d3164bac4b53 /scene/3d
parentec60c4ee9e5d5a4452bf43cba44d4fefa56261da (diff)
parent10395f5df2a1cac6ed83e674c084e62a88fcdde9 (diff)
Merge pull request #64728 from fabriceci/only-report-recovery-for-floor-snapping
Turn on recovery as collisions only for floor snapping
Diffstat (limited to 'scene/3d')
-rw-r--r--scene/3d/physics_body_3d.cpp7
1 files changed, 2 insertions, 5 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp
index c6c59a5c64..0c5385dcbe 100644
--- a/scene/3d/physics_body_3d.cpp
+++ b/scene/3d/physics_body_3d.cpp
@@ -1210,7 +1210,6 @@ bool CharacterBody3D::move_and_slide() {
if (!current_platform_velocity.is_zero_approx()) {
PhysicsServer3D::MotionParameters parameters(get_global_transform(), current_platform_velocity * delta, margin);
- parameters.recovery_as_collision = true; // Also report collisions generated only from recovery.
parameters.exclude_bodies.insert(platform_rid);
if (platform_object_id.is_valid()) {
@@ -1275,7 +1274,6 @@ void CharacterBody3D::_move_and_slide_grounded(double p_delta, bool p_was_on_flo
for (int iteration = 0; iteration < max_slides; ++iteration) {
PhysicsServer3D::MotionParameters parameters(get_global_transform(), motion, margin);
parameters.max_collisions = 4;
- parameters.recovery_as_collision = true; // Also report collisions generated only from recovery.
PhysicsServer3D::MotionResult result;
bool collided = move_and_collide(parameters, result, false, !sliding_enabled);
@@ -1520,7 +1518,6 @@ void CharacterBody3D::_move_and_slide_floating(double p_delta) {
bool first_slide = true;
for (int iteration = 0; iteration < max_slides; ++iteration) {
PhysicsServer3D::MotionParameters parameters(get_global_transform(), motion, margin);
- parameters.recovery_as_collision = true; // Also report collisions generated only from recovery.
PhysicsServer3D::MotionResult result;
bool collided = move_and_collide(parameters, result, false, false);
@@ -1575,7 +1572,7 @@ void CharacterBody3D::_snap_on_floor(bool p_was_on_floor, bool p_vel_dir_facing_
PhysicsServer3D::MotionParameters parameters(get_global_transform(), -up_direction * length, margin);
parameters.max_collisions = 4;
- parameters.recovery_as_collision = true; // Also report collisions generated only from recovery.
+ parameters.recovery_as_collision = true; // Report margin recovery as collision to improve floor detection.
parameters.collide_separation_ray = true;
PhysicsServer3D::MotionResult result;
@@ -1611,7 +1608,7 @@ bool CharacterBody3D::_on_floor_if_snapped(bool p_was_on_floor, bool p_vel_dir_f
PhysicsServer3D::MotionParameters parameters(get_global_transform(), -up_direction * length, margin);
parameters.max_collisions = 4;
- parameters.recovery_as_collision = true; // Also report collisions generated only from recovery.
+ parameters.recovery_as_collision = true; // Report margin recovery as collision to improve floor detection.
parameters.collide_separation_ray = true;
PhysicsServer3D::MotionResult result;