summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2017-08-16 17:06:54 +0200
committerGitHub <noreply@github.com>2017-08-16 17:06:54 +0200
commit5422585db6a2405e5481a2ffbe5c9085b17e0521 (patch)
treebf0ba40dbedb4771c21a19244b914f3dacc5256e
parent035d74f54a1e2acdde50fb204b3d07a2a40f41ee (diff)
parente1bdf810086ca17595bc397e5ad53cfafc128ec6 (diff)
Merge pull request #10373 from RandomShaper/remove-physics-check
Remove needless check in motion test
-rw-r--r--servers/physics_2d/space_2d_sw.cpp30
1 files changed, 13 insertions, 17 deletions
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index a17d1f6a12..29f879d8e9 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -678,25 +678,21 @@ bool Space2DSW::test_body_motion(Body2DSW *p_body, const Transform2D &p_from, co
}
}
- if (col_obj->get_type() == CollisionObject2DSW::TYPE_BODY) {
+ if (col_obj->is_shape_set_as_one_way_collision(j)) {
- const Body2DSW *body = static_cast<const Body2DSW *>(col_obj);
- if (col_obj->is_shape_set_as_one_way_collision(j)) {
+ Vector2 cd[2];
+ Physics2DServerSW::CollCbkData cbk;
+ cbk.max = 1;
+ cbk.amount = 0;
+ cbk.ptr = cd;
+ cbk.valid_dir = body_shape_xform.get_axis(1).normalized();
+ ;
+ cbk.valid_depth = 10e20;
- Vector2 cd[2];
- Physics2DServerSW::CollCbkData cbk;
- cbk.max = 1;
- cbk.amount = 0;
- cbk.ptr = cd;
- cbk.valid_dir = body_shape_xform.get_axis(1).normalized();
- ;
- cbk.valid_depth = 10e20;
-
- Vector2 sep = mnormal; //important optimization for this to work fast enough
- bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0);
- if (!collided || cbk.amount == 0) {
- continue;
- }
+ Vector2 sep = mnormal; //important optimization for this to work fast enough
+ bool collided = CollisionSolver2DSW::solve(body_shape, body_shape_xform, p_motion * (hi + contact_max_allowed_penetration), col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), Physics2DServerSW::_shape_col_cbk, &cbk, &sep, 0);
+ if (!collided || cbk.amount == 0) {
+ continue;
}
}