1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42
| this.sideWalls = new Body(world); this.sideWalls.setGravityMode(0);
this.groundGeomB = new GeomBox((float)this.bounds.getWidth(), 10f, 50f); this.groundGeomT = new GeomBox((float)this.bounds.getWidth(), 10f, 50f); this.groundGeomL = new GeomBox(10f, (float)this.bounds.getHeight(), 50f); this.groundGeomR = new GeomBox(10f, (float)this.bounds.getHeight(), 50f);
this.groundGeomBE = new GeomTransform("t1"); this.groundGeomTE = new GeomTransform("t2"); this.groundGeomLE = new GeomTransform("t3"); this.groundGeomRE = new GeomTransform("t4");
this.groundGeomBE.setEncapsulatedGeom(this.groundGeomB); this.groundGeomTE.setEncapsulatedGeom(this.groundGeomT); this.groundGeomLE.setEncapsulatedGeom(this.groundGeomL); this.groundGeomRE.setEncapsulatedGeom(this.groundGeomR);
this.sideWalls.addGeom(this.groundGeomBE); this.sideWalls.addGeom(this.groundGeomTE); this.sideWalls.addGeom(this.groundGeomLE); this.sideWalls.addGeom(this.groundGeomRE);
this.groundGeomB.setPosition(0f, (float)(-1 * this.bounds.getHeight()/2 - 5), 0f); this.groundGeomT.setPosition(0f, (float)(this.bounds.getHeight() + 5), 0f); this.groundGeomL.setPosition((float)(-1 * this.bounds.getWidth()/2 - 5), 0f, 0f); this.groundGeomR.setPosition((float)(this.bounds.getWidth()/2 + 5), 0f, 0f);
this.geomIDs.add(this.groundGeomBE.getNativeAddr()); this.geomIDs.add(this.groundGeomLE.getNativeAddr()); this.geomIDs.add(this.groundGeomRE.getNativeAddr()); this.geomIDs.add(this.groundGeomTE.getNativeAddr());
this.sideWalls.adjustMass(10f); this.sideWalls.setPosition((float)(this.bounds.getWidth()/2 + this.bounds.getX()), (float)(this.bounds.getHeight()/2 + this.bounds.getY()), 0f);
space.addBodyGeoms(this.sideWalls); this.sideWalls.setAngularVel(50, 0, 0); this.sideWalls.addRelTorque(5000,0,5000); |