diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 2f6b575ea3e..6b951dfc9c2 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -962,8 +962,13 @@ Ref KinematicBody::_move(const Vector3 &p_motion, bool p_inf bool collided = move_and_collide(p_motion, p_infinite_inertia, col, p_exclude_raycast_shapes, p_test_only); + // Ugly hack as a hot fix, 65b3200 fix an issue but cause a problem with Bullet that broke games using Bullet. + // The bug is something internal to Bullet, seems to be related to the Bullet’s margin. As not proper fix was found yet, + // this temporary solution solves the issue for games using Bullet. + bool is_bullet = PhysicsServerManager::current_server_id != 0; + // Don't report collision when the whole motion is done. - if (collided && col.collision_safe_fraction < 1) { + if (collided && (col.collision_safe_fraction < 1 || is_bullet)) { // Create a new instance when the cached reference is invalid or still in use in script. if (motion_cache.is_null() || motion_cache->reference_get_count() > 1) { motion_cache.instance(); diff --git a/servers/physics_server.cpp b/servers/physics_server.cpp index b04a3fa36b4..3c0250893a3 100644 --- a/servers/physics_server.cpp +++ b/servers/physics_server.cpp @@ -810,6 +810,7 @@ PhysicsServer::~PhysicsServer() { Vector PhysicsServerManager::physics_servers; int PhysicsServerManager::default_server_id = -1; +int PhysicsServerManager::current_server_id = -1; int PhysicsServerManager::default_server_priority = -1; const String PhysicsServerManager::setting_property_name(PNAME("physics/3d/physics_engine")); @@ -857,6 +858,7 @@ String PhysicsServerManager::get_server_name(int p_id) { PhysicsServer *PhysicsServerManager::new_default_server() { ERR_FAIL_COND_V(default_server_id == -1, nullptr); + current_server_id = default_server_id; return physics_servers[default_server_id].create_callback(); } @@ -865,6 +867,7 @@ PhysicsServer *PhysicsServerManager::new_server(const String &p_name) { if (id == -1) { return nullptr; } else { + current_server_id = id; return physics_servers[id].create_callback(); } } diff --git a/servers/physics_server.h b/servers/physics_server.h index c2c5d74844d..fbbfdbb1921 100644 --- a/servers/physics_server.h +++ b/servers/physics_server.h @@ -807,6 +807,7 @@ class PhysicsServerManager { public: static const String setting_property_name; + static int current_server_id; private: static void on_servers_changed();