Game Development Reference
In-Depth Information
protected BulletObjects() {
super();
}
@Override
public void init() {
super.init();
final ModelBuilder builder = new ModelBuilder();
float width, height, radius;
width = 20;
builder.begin();
MeshPartBuilder mpb = builder.part("parts",
GL20.GL_TRIANGLES, Usage.Position | Usage.Normal |
Usage.Color, new Material(ColorAttribute.createDiffuse(Color.
WHITE)));
mpb.setColor(1f, 1f, 1f, 1f);
mpb.box(0, 0, 0, 2 * width, 1, 2 * width);
groundModel = builder.end();
groundShape = new btBoxShape(new Vector3(width, 1 / 2f,
width));
width = 2f;
boxModel = builder.createBox(width, width, width, new
Material(ColorAttribute.createDiffuse(Color.GREEN)), Usage.
Position | Usage.Normal);
boxShape = new btBoxShape(new Vector3(width, width,
width).scl(.5f));
width = 1.5f;
height = 2f;
coneModel = builder.createCone(width, height, width, 20,
new Material(ColorAttribute.createDiffuse(Color.LIGHT_GRAY)),
Usage.Position | Usage.Normal);
coneShape = new btConeShape(width / 2f, height);
radius = 2f;
sphereModel = builder.createSphere(radius, radius,
radius, 20, 20, new Material(ColorAttribute.createDiffuse(Color.
ORANGE)),
Usage.Position | Usage.Normal);
sphereShape = new btSphereShape(radius / 2f);
width = 2f;
 
Search WWH ::




Custom Search