use of spacegraph.space2d.phys.collision.shapes.PolygonShape in project narchy by automenta.
the class Racer method initRacetrackBorders.
private void initRacetrackBorders() {
// final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
final PolygonShape bottomOuter = PolygonShape.box(0, CAMERA_HEIGHT - 2, CAMERA_WIDTH, 2);
final PolygonShape topOuter = PolygonShape.box(0, 0, CAMERA_WIDTH, 2);
final PolygonShape leftOuter = PolygonShape.box(0, 0, 2, CAMERA_HEIGHT);
final PolygonShape rightOuter = PolygonShape.box(CAMERA_WIDTH - 2, 0, 2, CAMERA_HEIGHT);
final PolygonShape bottomInner = PolygonShape.box(RACETRACK_WIDTH, CAMERA_HEIGHT - 2 - RACETRACK_WIDTH, CAMERA_WIDTH - 2 * RACETRACK_WIDTH, 2);
final PolygonShape topInner = PolygonShape.box(RACETRACK_WIDTH, RACETRACK_WIDTH, CAMERA_WIDTH - 2 * RACETRACK_WIDTH, 2);
final PolygonShape leftInner = PolygonShape.box(RACETRACK_WIDTH, RACETRACK_WIDTH, 2, CAMERA_HEIGHT - 2 * RACETRACK_WIDTH);
final PolygonShape rightInner = PolygonShape.box(CAMERA_WIDTH - 2 - RACETRACK_WIDTH, RACETRACK_WIDTH, 2, CAMERA_HEIGHT - 2 * RACETRACK_WIDTH);
// final FixtureDef wallFixtureDef = new FixtureDef(bottomOuter, 0, 0.5f);
// // wallFixtureDef.restitution = 0.5f;
this.mPhysicsWorld.addStatic(new FixtureDef(bottomOuter, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(leftOuter, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(rightOuter, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(topOuter, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(bottomInner, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(leftInner, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(rightInner, 0, 0.5f));
this.mPhysicsWorld.addStatic(new FixtureDef(topInner, 0, 0.5f));
}
Aggregations