public void check_box_collision(box box) { for (int x = 0; x < x_node_count; x++) { for (int y = 0; y < y_node_count; y++) { box.node_hit_test(grid[x, y]); } } for (int x = 0; x < x_node_count - 1; x++) { for (int y = 0; y < y_node_count; y++) { if (box.hit_test(grid[x, y].next_position, grid[x + 1, y].next_position)) { grid[x, y].next_position = grid[x, y].position; grid[x, y].velocity = new Vector3D(); grid[x + 1, y].next_position = grid[x + 1, y].position; grid[x + 1, y].velocity = new Vector3D(); } } } for (int x = 0; x < x_node_count; x++) { for (int y = 0; y < y_node_count - 1; y++) { if (box.hit_test(grid[x, y].next_position, grid[x, y + 1].next_position)) { grid[x, y].next_position = grid[x, y].position; grid[x, y].velocity = new Vector3D(); grid[x, y + 1].next_position = grid[x, y + 1].position; grid[x, y + 1].velocity = new Vector3D(); } } } }