summaryrefslogtreecommitdiff
path: root/servers/physics_2d
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2018-08-24 09:35:07 +0200
committerRémi Verschelde <rverschelde@gmail.com>2018-08-24 14:59:01 +0200
commit52466d57e9c2897c40698a09482e5e7de230368f (patch)
tree54ff3bb78961ca5d8120cc7e6abe91f5c99d92b7 /servers/physics_2d
parentd442f3d0aa4185f154bee396efaf24ceb73c9d84 (diff)
Make some debug prints verbose-only, remove others
Diffstat (limited to 'servers/physics_2d')
-rw-r--r--servers/physics_2d/collision_solver_2d_sat.cpp1
-rw-r--r--servers/physics_2d/collision_solver_2d_sw.cpp45
-rw-r--r--servers/physics_2d/physics_2d_server_sw.cpp7
-rw-r--r--servers/physics_2d/space_2d_sw.cpp14
-rw-r--r--servers/physics_2d/step_2d_sw.cpp2
5 files changed, 4 insertions, 65 deletions
diff --git a/servers/physics_2d/collision_solver_2d_sat.cpp b/servers/physics_2d/collision_solver_2d_sat.cpp
index 0d1ffca50d..98fe4adb80 100644
--- a/servers/physics_2d/collision_solver_2d_sat.cpp
+++ b/servers/physics_2d/collision_solver_2d_sat.cpp
@@ -300,7 +300,6 @@ public:
}
}
-//print_line("test axis: "+p_axis+" depth: "+rtos(best_depth));
#ifdef DEBUG_ENABLED
best_axis_count++;
#endif
diff --git a/servers/physics_2d/collision_solver_2d_sw.cpp b/servers/physics_2d/collision_solver_2d_sw.cpp
index 6ce019f36e..b03a193d97 100644
--- a/servers/physics_2d/collision_solver_2d_sw.cpp
+++ b/servers/physics_2d/collision_solver_2d_sw.cpp
@@ -114,35 +114,6 @@ bool CollisionSolver2DSW::solve_raycast(const Shape2DSW *p_shape_A, const Vector
return true;
}
-/*
-bool CollisionSolver2DSW::solve_ray(const Shape2DSW *p_shape_A,const Matrix32& p_transform_A,const Shape2DSW *p_shape_B,const Matrix32& p_transform_B,const Matrix32& p_inverse_B,CallbackResult p_result_callback,void *p_userdata,bool p_swap_result) {
-
-
- const RayShape2DSW *ray = static_cast<const RayShape2DSW*>(p_shape_A);
-
- Vector2 from = p_transform_A.origin;
- Vector2 to = from+p_transform_A.basis.get_axis(2)*ray->get_length();
- Vector2 support_A=to;
-
- from = p_inverse_B.xform(from);
- to = p_inverse_B.xform(to);
-
- Vector2 p,n;
- if (!p_shape_B->intersect_segment(from,to,&p,&n))
- return false;
-
- Vector2 support_B=p_transform_B.xform(p);
-
- if (p_result_callback) {
- if (p_swap_result)
- p_result_callback(support_B,support_A,p_userdata);
- else
- p_result_callback(support_A,support_B,p_userdata);
- }
- return true;
-}
-*/
-
struct _ConcaveCollisionInfo2D {
const Transform2D *transform_A;
@@ -219,7 +190,6 @@ bool CollisionSolver2DSW::solve_concave(const Shape2DSW *p_shape_A, const Transf
concave_B->cull(local_aabb, concave_callback, &cinfo);
- //print_line("Rect2 TESTS: "+itos(cinfo.aabb_tests));
return cinfo.collided;
}
@@ -245,10 +215,6 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
if (type_B == Physics2DServer::SHAPE_LINE || type_B == Physics2DServer::SHAPE_RAY) {
return false;
}
- /*
- if (type_B==Physics2DServer::SHAPE_RAY) {
- return false;
- */
if (swap) {
return solve_static_line(p_shape_B, p_transform_B, p_shape_A, p_transform_A, p_result_callback, p_userdata, true);
@@ -256,17 +222,6 @@ bool CollisionSolver2DSW::solve(const Shape2DSW *p_shape_A, const Transform2D &p
return solve_static_line(p_shape_A, p_transform_A, p_shape_B, p_transform_B, p_result_callback, p_userdata, false);
}
- /*} else if (type_A==Physics2DServer::SHAPE_RAY) {
-
- if (type_B==Physics2DServer::SHAPE_RAY)
- return false;
-
- if (swap) {
- return solve_ray(p_shape_B,p_transform_B,p_shape_A,p_transform_A,p_inverse_A,p_result_callback,p_userdata,true);
- } else {
- return solve_ray(p_shape_A,p_transform_A,p_shape_B,p_transform_B,p_inverse_B,p_result_callback,p_userdata,false);
- }
-*/
} else if (type_A == Physics2DServer::SHAPE_RAY) {
if (type_B == Physics2DServer::SHAPE_RAY) {
diff --git a/servers/physics_2d/physics_2d_server_sw.cpp b/servers/physics_2d/physics_2d_server_sw.cpp
index 15e80bcd5e..721f21fc40 100644
--- a/servers/physics_2d/physics_2d_server_sw.cpp
+++ b/servers/physics_2d/physics_2d_server_sw.cpp
@@ -171,13 +171,14 @@ void Physics2DServerSW::_shape_col_cbk(const Vector2 &p_point_A, const Vector2 &
}
if (cbk->valid_dir.dot((p_point_A - p_point_B).normalized()) < 0.7071) {
cbk->invalid_by_dir++;
- ;
- /* print_line("A: "+p_point_A);
+
+ /*
+ print_line("A: "+p_point_A);
print_line("B: "+p_point_B);
print_line("discard too angled "+rtos(cbk->valid_dir.dot((p_point_A-p_point_B))));
print_line("resnorm: "+(p_point_A-p_point_B).normalized());
print_line("distance: "+rtos(p_point_A.distance_to(p_point_B)));
-*/
+ */
return;
}
}
diff --git a/servers/physics_2d/space_2d_sw.cpp b/servers/physics_2d/space_2d_sw.cpp
index ecebd09436..746aa2d49b 100644
--- a/servers/physics_2d/space_2d_sw.cpp
+++ b/servers/physics_2d/space_2d_sw.cpp
@@ -234,11 +234,6 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
aabb = aabb.merge(Rect2(aabb.position + p_motion, aabb.size)); //motion
aabb = aabb.grow(p_margin);
- /*
- if (p_motion!=Vector2())
- print_line(p_motion);
- */
-
int amount = space->broadphase->cull_aabb(aabb, space->intersection_query_results, Space2DSW::INTERSECTION_QUERY_MAX, space->intersection_query_subindex_results);
real_t best_safe = 1;
@@ -255,15 +250,6 @@ bool Physics2DDirectSpaceStateSW::cast_motion(const RID &p_shape, const Transfor
const CollisionObject2DSW *col_obj = space->intersection_query_results[i];
int shape_idx = space->intersection_query_subindex_results[i];
- /*if (col_obj->get_type()==CollisionObject2DSW::TYPE_BODY) {
-
- const Body2DSW *body=static_cast<const Body2DSW*>(col_obj);
- if (body->get_one_way_collision_direction()!=Vector2() && p_motion.dot(body->get_one_way_collision_direction())<=CMP_EPSILON) {
- print_line("failed in motion dir");
- continue;
- }
- }*/
-
Transform2D col_obj_xform = col_obj->get_transform() * col_obj->get_shape_transform(shape_idx);
//test initial overlap, does it collide if going all the way?
if (!CollisionSolver2DSW::solve(shape, p_xform, p_motion, col_obj->get_shape(shape_idx), col_obj_xform, Vector2(), NULL, NULL, NULL, p_margin)) {
diff --git a/servers/physics_2d/step_2d_sw.cpp b/servers/physics_2d/step_2d_sw.cpp
index 6108b885f0..d1078f1506 100644
--- a/servers/physics_2d/step_2d_sw.cpp
+++ b/servers/physics_2d/step_2d_sw.cpp
@@ -209,8 +209,6 @@ void Step2DSW::step(Space2DSW *p_space, real_t p_delta, int p_iterations) {
p_space->area_remove_from_moved_list((SelfList<Area2DSW> *)aml.first()); //faster to remove here
}
- //print_line("island count: "+itos(island_count)+" active count: "+itos(active_count));
-
{ //profile
profile_endtime = OS::get_singleton()->get_ticks_usec();
p_space->set_elapsed_time(Space2DSW::ELAPSED_TIME_GENERATE_ISLANDS, profile_endtime - profile_begtime);