Vector3f localInertia = new Vector3f(0, 0, 0);
RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(0,
motionState, groundShape, localInertia);
// Create the rigid body and add it to the dynamicsworld.
RigidBody body = new RigidBody(rbInfo);
getDynamicsWorld().addRigidBody(body);
// Set friction.
//body.setFriction(1);
// Store locally.
this.ground = body;
}
else {
System.out.println("Using chess surface ground");
BoxShape bShape = new BoxShape(new Vector3f(20, 10, 20));
for (int i = 0; i < 20; i++) {
for (int j = 0; j < 21; j++) {
// Create transform to store ground's location.
Transform transform = new Transform();
transform.setIdentity();
float x = -10 * 40 + i * 40;
float z = -10 * 40 + j * 40;
transform.origin.set(new Vector3f(x, -10, z));
// Create new MotionState to keep track of object.
DefaultMotionState motionState = new DefaultMotionState(
transform);
Vector3f localInertia = new Vector3f(0, 0, 0);
RigidBodyConstructionInfo rbInfo = new RigidBodyConstructionInfo(
0, motionState, bShape, localInertia);
// Create the rigid body and add it to the dynamicsworld.
RigidBody body = new RigidBody(rbInfo);
getDynamicsWorld().addRigidBody(body);
// Set friction.
body.setFriction(1);
body.setRestitution(1);
}
}
}
// Set gravity.