Merge pull request #64875 from fabriceci/ulgy-hack-bullet-margin
This commit is contained in:
commit
bbaedffb93
|
@ -962,8 +962,13 @@ Ref<KinematicCollision> 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();
|
||||
|
|
|
@ -810,6 +810,7 @@ PhysicsServer::~PhysicsServer() {
|
|||
|
||||
Vector<PhysicsServerManager::ClassInfo> 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();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -807,6 +807,7 @@ class PhysicsServerManager {
|
|||
|
||||
public:
|
||||
static const String setting_property_name;
|
||||
static int current_server_id;
|
||||
|
||||
private:
|
||||
static void on_servers_changed();
|
||||
|
|
Loading…
Reference in New Issue