From ceeb69047699043920d2efe1fa3eaddd886a9980 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Tue, 14 Jul 2020 10:19:58 -0300 Subject: [PATCH] Properly pass safe margin on initialization. Fixes jitter. (cherry picked from commit 13e0385702c9b5d152f2781ff566e07db9aeddc3) --- scene/3d/physics_body.cpp | 5 +++-- servers/physics/body_sw.cpp | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/scene/3d/physics_body.cpp b/scene/3d/physics_body.cpp index 1e9e6672262..46932b80e92 100644 --- a/scene/3d/physics_body.cpp +++ b/scene/3d/physics_body.cpp @@ -1432,13 +1432,14 @@ void KinematicBody::_bind_methods() { KinematicBody::KinematicBody() : PhysicsBody(PhysicsServer::BODY_MODE_KINEMATIC) { - - margin = 0.001; locked_axis = 0; on_floor = false; on_ceiling = false; on_wall = false; + + set_safe_margin(0.001); } + KinematicBody::~KinematicBody() { if (motion_cache.is_valid()) { diff --git a/servers/physics/body_sw.cpp b/servers/physics/body_sw.cpp index 64e07e1155a..c8b3ddf27f0 100644 --- a/servers/physics/body_sw.cpp +++ b/servers/physics/body_sw.cpp @@ -773,7 +773,7 @@ BodySW::BodySW() : active = true; mass = 1; - kinematic_safe_margin = 0.01; + kinematic_safe_margin = 0.001; //_inv_inertia=Transform(); _inv_mass = 1; bounce = 0;