-Re-added margins in one way collision (made in a more user friendly way than in Godot 2.1), fixes #23860
-Fixed potential bug in OWC (i dont think anyone had it but..)
This commit is contained in:
@@ -209,12 +209,14 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &
|
||||
return;
|
||||
cbk->ptr[min_depth_idx * 2 + 0] = p_point_A;
|
||||
cbk->ptr[min_depth_idx * 2 + 1] = p_point_B;
|
||||
cbk->passed++;
|
||||
|
||||
} else {
|
||||
|
||||
cbk->ptr[cbk->amount * 2 + 0] = p_point_A;
|
||||
cbk->ptr[cbk->amount * 2 + 1] = p_point_B;
|
||||
cbk->amount++;
|
||||
cbk->passed++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +235,7 @@ bool Physics2DServerSW::shape_collide(RID p_shape_A, const Transform2D &p_xform_
|
||||
CollCbkData cbk;
|
||||
cbk.max = p_result_max;
|
||||
cbk.amount = 0;
|
||||
cbk.passed = 0;
|
||||
cbk.ptr = r_results;
|
||||
|
||||
bool res = CollisionSolver2DSW::solve(shape_A, p_xform_A, p_motion_A, shape_B, p_xform_B, p_motion_B, _shape_col_cbk, &cbk);
|
||||
@@ -740,14 +743,14 @@ void Physics2DServerSW::body_set_shape_disabled(RID p_body, int p_shape_idx, boo
|
||||
|
||||
body->set_shape_as_disabled(p_shape_idx, p_disabled);
|
||||
}
|
||||
void Physics2DServerSW::body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable) {
|
||||
void Physics2DServerSW::body_set_shape_as_one_way_collision(RID p_body, int p_shape_idx, bool p_enable, float p_margin) {
|
||||
|
||||
Body2DSW *body = body_owner.get(p_body);
|
||||
ERR_FAIL_COND(!body);
|
||||
|
||||
ERR_FAIL_INDEX(p_shape_idx, body->get_shape_count());
|
||||
|
||||
body->set_shape_as_one_way_collision(p_shape_idx, p_enable);
|
||||
body->set_shape_as_one_way_collision(p_shape_idx, p_enable, p_margin);
|
||||
}
|
||||
|
||||
void Physics2DServerSW::body_set_continuous_collision_detection_mode(RID p_body, CCDMode p_mode) {
|
||||
|
||||
Reference in New Issue
Block a user