// attach diagonal constraints
for (int x = 0; x < width - 1; x++) {
for (int y = 0; y < height - 1; y++) {
DBallJoint joint = joints[jointCounter];
joint = OdeHelper.createBallJoint(env.getWorld());
joint.attach(bodyMatrix[x][y],bodyMatrix[x + 1][y + 1]);
joint.setParam(DJoint.PARAM_N.dParamCFM1, cfmAng1);
joint.setParam(DJoint.PARAM_N.dParamERP1, erpAng1);
joint.setParam(DJoint.PARAM_N.dParamFMax1, fmaxAng1);
jointCounter++;
}