diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-08-09 23:20:44 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-09 23:20:44 +0200 |
commit | 2de5d2361ac39e61c610d6fc0f161a1237ae2815 (patch) | |
tree | 393cad3673fe40a5291c7c5e458e5935b977d8a5 /scene/3d | |
parent | 7bcfc66fb4253fb121008809e4e81c5b704776b7 (diff) | |
parent | 5650c83e4b7f669066685a9f5526d7ec56e9b43d (diff) |
Merge pull request #51446 from nekomatata/fix-moving-platform-rotation
Fix applied rotation from moving platforms in move_and_slide
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index 100e3563a3..38104a8365 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1101,7 +1101,9 @@ void CharacterBody3D::move_and_slide() { //this approach makes sure there is less delay between the actual body velocity and the one we saved PhysicsDirectBodyState3D *bs = PhysicsServer3D::get_singleton()->body_get_direct_state(on_floor_body); if (bs) { - current_floor_velocity = bs->get_linear_velocity(); + Transform3D gt = get_global_transform(); + Vector3 local_position = gt.origin - bs->get_transform().origin; + current_floor_velocity = bs->get_velocity_at_local_position(local_position); } } |