diff options
Diffstat (limited to 'servers/physics')
| -rw-r--r-- | servers/physics/collision_solver_sat.cpp | 18 | ||||
| -rw-r--r-- | servers/physics/physics_server_sw.cpp | 11 |
2 files changed, 20 insertions, 9 deletions
diff --git a/servers/physics/collision_solver_sat.cpp b/servers/physics/collision_solver_sat.cpp index eefb0f0396..e587485fcb 100644 --- a/servers/physics/collision_solver_sat.cpp +++ b/servers/physics/collision_solver_sat.cpp @@ -341,26 +341,26 @@ public: min_B -= (max_A - min_A) * 0.5; max_B += (max_A - min_A) * 0.5; - real_t dmin = min_B - (min_A + max_A) * 0.5; - real_t dmax = max_B - (min_A + max_A) * 0.5; + min_B -= (min_A + max_A) * 0.5; + max_B -= (min_A + max_A) * 0.5; - if (dmin > 0.0 || dmax < 0.0) { + if (min_B > 0.0 || max_B < 0.0) { separator_axis = axis; return false; // doesn't contain 0 } //use the smallest depth - dmin = Math::abs(dmin); + min_B = -min_B; - if (dmax < dmin) { - if (dmax < best_depth) { - best_depth = dmax; + if (max_B < min_B) { + if (max_B < best_depth) { + best_depth = max_B; best_axis = axis; } } else { - if (dmin < best_depth) { - best_depth = dmin; + if (min_B < best_depth) { + best_depth = min_B; best_axis = -axis; // keep it as A axis } } diff --git a/servers/physics/physics_server_sw.cpp b/servers/physics/physics_server_sw.cpp index 57fa4f2511..f1e0cbef29 100644 --- a/servers/physics/physics_server_sw.cpp +++ b/servers/physics/physics_server_sw.cpp @@ -65,6 +65,11 @@ RID PhysicsServerSW::shape_create(ShapeType p_shape) { shape = memnew(CapsuleShapeSW); } break; + case SHAPE_CYLINDER: { + + ERR_EXPLAIN("CylinderShape is not supported in GodotPhysics. Please switch to Bullet in the Project Settings."); + ERR_FAIL_V(RID()); + } break; case SHAPE_CONVEX_POLYGON: { shape = memnew(ConvexPolygonShapeSW); @@ -1376,6 +1381,8 @@ void PhysicsServerSW::init() { void PhysicsServerSW::step(real_t p_step) { +#ifndef _3D_DISABLED + if (!active) return; @@ -1396,6 +1403,7 @@ void PhysicsServerSW::step(real_t p_step) { active_objects += E->get()->get_active_objects(); collision_pairs += E->get()->get_collision_pairs(); } +#endif } void PhysicsServerSW::sync(){ @@ -1404,6 +1412,8 @@ void PhysicsServerSW::sync(){ void PhysicsServerSW::flush_queries() { +#ifndef _3D_DISABLED + if (!active) return; @@ -1450,6 +1460,7 @@ void PhysicsServerSW::flush_queries() { ScriptDebugger::get_singleton()->add_profiling_frame_data("physics", values); } +#endif }; void PhysicsServerSW::finish() { |
