summaryrefslogtreecommitdiff
path: root/tests/servers/test_physics_2d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/servers/test_physics_2d.cpp')
-rw-r--r--tests/servers/test_physics_2d.cpp30
1 files changed, 3 insertions, 27 deletions
diff --git a/tests/servers/test_physics_2d.cpp b/tests/servers/test_physics_2d.cpp
index 8b77458a33..138412ec09 100644
--- a/tests/servers/test_physics_2d.cpp
+++ b/tests/servers/test_physics_2d.cpp
@@ -84,6 +84,7 @@ class TestPhysics2DMainLoop : public MainLoop {
body_shape_data[PhysicsServer2D::SHAPE_SEGMENT].shape = segment_shape;
}
+
// CIRCLE
{
@@ -182,10 +183,7 @@ class TestPhysics2DMainLoop : public MainLoop {
}
void _do_ray_query() {
- /*
- PhysicsServer2D *ps = PhysicsServer2D::get_singleton();
- ps->query_intersection_segment(ray_query,ray_from,ray_to);
- */
+ // FIXME: Do something?
}
protected:
@@ -231,11 +229,10 @@ protected:
ps->body_set_continuous_collision_detection_mode(body, PhysicsServer2D::CCD_MODE_CAST_SHAPE);
ps->body_set_state(body, PhysicsServer2D::BODY_STATE_TRANSFORM, p_xform);
- //print_line("add body with xform: "+p_xform);
RID sprite = vs->canvas_item_create();
vs->canvas_item_set_parent(sprite, canvas);
vs->canvas_item_set_transform(sprite, p_xform);
- Size2 imgsize(5, 5); //vs->texture_get_width(body_shape_data[p_shape].image), vs->texture_get_height(body_shape_data[p_shape].image));
+ Size2 imgsize(5, 5);
vs->canvas_item_add_texture_rect(sprite, Rect2(-imgsize / 2.0, imgsize), body_shape_data[p_shape].image);
ps->body_set_force_integration_callback(body, callable_mp(this, &TestPhysics2DMainLoop::_body_moved), sprite);
@@ -326,21 +323,11 @@ public:
vs->viewport_set_size(vp, screen_size.x, screen_size.y);
vs->viewport_attach_to_screen(vp, Rect2(Vector2(), screen_size));
vs->viewport_set_active(vp, true);
-
- Transform2D smaller;
- //smaller.scale(Vector2(0.6,0.6));
- //smaller.elements[2]=Vector2(100,0);
-
- //view_xform = smaller;
vs->viewport_set_canvas_transform(vp, canvas, view_xform);
}
ray = vs->canvas_item_create();
vs->canvas_item_set_parent(ray, canvas);
- //ray_query = ps->query_create(this,"_ray_query_callback",Variant());
- //ps->query_intersection(ray_query,space);
-
- _create_body_shape_data();
for (int i = 0; i < 32; i++) {
PhysicsServer2D::ShapeType types[4] = {
@@ -352,17 +339,9 @@ public:
};
PhysicsServer2D::ShapeType type = types[i % 4];
- //type=PhysicsServer2D::SHAPE_SEGMENT;
_add_body(type, Transform2D(i * 0.8, Point2(152 + i * 40, 100 - 40 * i)));
- /*
- if (i==0)
- ps->body_set_mode(b,PhysicsServer2D::BODY_MODE_STATIC);
- */
}
- //RID b= _add_body(PhysicsServer2D::SHAPE_CIRCLE,Transform2D(0,Point2(101,140)));
- //ps->body_set_mode(b,PhysicsServer2D::BODY_MODE_STATIC);
-
Point2 prev;
Vector<Point2> parr;
@@ -376,9 +355,6 @@ public:
}
_add_concave(parr);
- //_add_world_boundary(Vector2(0.0,-1).normalized(),-300);
- //_add_world_boundary(Vector2(1,0).normalized(),50);
- //_add_world_boundary(Vector2(-1,0).normalized(),-600);
}
virtual bool process(double p_time) override {