diff options
author | fabriceci <fabricecipolla@gmail.com> | 2021-08-26 23:02:30 +0200 |
---|---|---|
committer | fabriceci <fabricecipolla@gmail.com> | 2021-08-26 23:02:30 +0200 |
commit | 4da0cfe45948de767d3cbbd6986b45e32ba73405 (patch) | |
tree | 6ca44f288ce2bf6add9d308e2c810fd2514c7a90 /scene/3d | |
parent | adafc509f33f83928881903f9fcba0eb6540fa96 (diff) |
Remove velocity transmission on_wall when collider is CharacterBody.
Diffstat (limited to 'scene/3d')
-rw-r--r-- | scene/3d/physics_body_3d.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/scene/3d/physics_body_3d.cpp b/scene/3d/physics_body_3d.cpp index d34331e1d8..816fa324d4 100644 --- a/scene/3d/physics_body_3d.cpp +++ b/scene/3d/physics_body_3d.cpp @@ -1229,8 +1229,11 @@ void CharacterBody3D::_set_collision_direction(const PhysicsServer3D::MotionResu on_ceiling = true; } else { on_wall = true; - on_floor_body = p_result.collider; - floor_velocity = p_result.collider_velocity; + // Don't apply wall velocity when the collider is a CharacterBody3D. + if (Object::cast_to<CharacterBody3D>(ObjectDB::get_instance(p_result.collider_id)) == nullptr) { + on_floor_body = p_result.collider; + floor_velocity = p_result.collider_velocity; + } } } } |