|
@@ -34,7 +34,7 @@
|
|
|
#define collision_solver sat_2d_calculate_penetration
|
|
|
//#define collision_solver gjk_epa_calculate_penetration
|
|
|
|
|
|
-bool GodotCollisionSolver2D::solve_static_world_boundary(const GodotShape2D *p_shape_A, const Transform2D &p_transform_A, const GodotShape2D *p_shape_B, const Transform2D &p_transform_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result) {
|
|
|
+bool GodotCollisionSolver2D::solve_static_world_boundary(const GodotShape2D *p_shape_A, const Transform2D &p_transform_A, const GodotShape2D *p_shape_B, const Transform2D &p_transform_B, const Vector2 &p_motion_B, CallbackResult p_result_callback, void *p_userdata, bool p_swap_result, real_t p_margin) {
|
|
|
const GodotWorldBoundaryShape2D *world_boundary = static_cast<const GodotWorldBoundaryShape2D *>(p_shape_A);
|
|
|
if (p_shape_B->get_type() == PhysicsServer2D::SHAPE_WORLD_BOUNDARY) {
|
|
|
return false;
|
|
@@ -52,7 +52,9 @@ bool GodotCollisionSolver2D::solve_static_world_boundary(const GodotShape2D *p_s
|
|
|
bool found = false;
|
|
|
|
|
|
for (int i = 0; i < support_count; i++) {
|
|
|
+ supports[i] += p_margin * supports[i].normalized();
|
|
|
supports[i] = p_transform_B.xform(supports[i]);
|
|
|
+ supports[i] += p_motion_B;
|
|
|
real_t pd = n.dot(supports[i]);
|
|
|
if (pd >= d) {
|
|
|
continue;
|
|
@@ -231,9 +233,9 @@ bool GodotCollisionSolver2D::solve(const GodotShape2D *p_shape_A, const Transfor
|
|
|
}
|
|
|
|
|
|
if (swap) {
|
|
|
- return solve_static_world_boundary(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true);
|
|
|
+ return solve_static_world_boundary(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_motion_A, p_result_callback, p_userdata, true, p_margin_A);
|
|
|
} else {
|
|
|
- return solve_static_world_boundary(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
|
|
|
+ return solve_static_world_boundary(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_motion_B, p_result_callback, p_userdata, false, p_margin_B);
|
|
|
}
|
|
|
|
|
|
} else if (type_A == PhysicsServer2D::SHAPE_SEPARATION_RAY) {
|