diff options
author | Camille Mohr-Daurat <pouleyKetchoup@gmail.com> | 2021-08-17 08:55:48 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 08:55:48 -0700 |
commit | 6cea7ebae4721e05ea7013c6159a751f7498ea85 (patch) | |
tree | d8a578619d699f7bd10bd18ec2f3c7153d63a31e | |
parent | 72cb4529375de4e3c7511cb7be4ffe8e0103d8ca (diff) | |
parent | 2084bb5eb9a88a9258db243a9955f7430f48e7b8 (diff) |
Merge pull request #51487 from nekomatata/fix-moving-platform-3d-snap
Fix 3D character snap on moving platforms
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 610974ff90..092efc55d7 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1176,11 +1176,6 @@ bool CharacterBody3D::move_and_slide() { } } - if (!on_floor && !on_wall) { - // Add last platform velocity when just left a moving platform. - linear_velocity += current_floor_velocity; - } - if (was_on_floor && snap != Vector3()) { // Apply snap. Transform3D gt = get_global_transform(); @@ -1213,6 +1208,11 @@ bool CharacterBody3D::move_and_slide() { } } + if (!on_floor && !on_wall) { + // Add last platform velocity when just left a moving platform. + linear_velocity += current_floor_velocity; + } + return motion_results.size() > 0; } |