@Override public boolean touchUp (int x, int y, int pointer, int button) { // if a mouse joint exists we simply destroy it if (mouseJoint != null) { world.destroyJoint(mouseJoint); mouseJoint = null; } return false; }
@Override public boolean touchUp (int x, int y, int pointer, int button) { // if a mouse joint exists we simply destroy it if (mouseJoint != null) { world.destroyJoint(mouseJoint); mouseJoint = null; } return false; }
/** Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during * callbacks. * @warning This automatically deletes all associated shapes and joints. * @warning This function is locked during callbacks. */ public void destroyBody (Body body) { Array<JointEdge> jointList = body.getJointList(); while (jointList.size > 0) destroyJoint(body.getJointList().get(0).joint); jniDestroyBody(addr, body.addr); body.setUserData(null); this.bodies.remove(body.addr); Array<Fixture> fixtureList = body.getFixtureList(); while(fixtureList.size > 0) { Fixture fixtureToDelete = fixtureList.removeIndex(0); this.fixtures.remove(fixtureToDelete.addr).setUserData(null); freeFixtures.free(fixtureToDelete); } freeBodies.free(body); }
@Override public boolean touchUp (int x, int y, int pointer, int button) { // if a mouse joint exists we simply destroy it if(button == Input.Buttons.RIGHT) { if (mouseJoint != null) { world.destroyJoint(mouseJoint); mouseJoint = null; } } return false; }
@Override public boolean touchUp (int x, int y, int pointer, int button) { // if a mouse joint exists we simply destroy it if(button == Input.Buttons.RIGHT) { if (mouseJoint != null) { world.destroyJoint(mouseJoint); mouseJoint = null; } } return false; }
@Override public boolean touchUp (int x, int y, int pointer, int button) { // if a mouse joint exists we simply destroy it if (mouseJoint != null) { world.destroyJoint(mouseJoint); mouseJoint = null; } return false; }
@Override public CompletionEnum execute(float dt) { Joint joint = executor.getPhysicsJoint(jointName); if(joint != null) executor.getWorld().destroyJoint(joint); else Log.error("JointRemoveManifestation.execute", "Box2d joint null with jointName: " + jointName); return CompletionEnum.COMPLETED; }
public void removeJoint(GDXJoint joint) { Log.log("JointMode.removeJoint", "Removing joint " + joint.toString()); if(joints.containsKey(joint.getName())) screen.getWorld().destroyJoint(joints.remove(joint.getName())); if(screen.getLevel().getJoints().contains(joint)) screen.getLevel().getJoints().remove(joint); }
/** * @return true if successful */ public boolean addJoint(GDXJoint joint){ if(joint instanceof GearJoint){ GearJoint gear = (GearJoint)joint; gear.initialize(joints.get(gear.getJoint1()), joints.get(gear.getJoint2())); } //destroy previous and make new joint if(joints.containsKey(joint.getName())) screen.getWorld().destroyJoint(joints.remove(joint.getName())); try{ joints.put(joint.getName(), joint.attach(screen.getWorld())); //add to level if(!screen.getLevel().getJoints().contains(joint)) screen.getLevel().getJoints().add(joint); Log.log("JointMode.addJoint", "Added joint " + joint.toString()); return true; }catch(Exception e){ Log.error("JointMode.addJoint", "Failed to add joint " + joint.toString() + ", exception: " + e.getClass() + ": " + e.getMessage()); return false; } }
for (Joint j : joints) { try { PhysicalWorld.WORLD.destroyJoint(j); } catch (Exception ex) {
/** Destroy a rigid body given a definition. No reference to the definition is retained. This function is locked during * callbacks. * @warning This automatically deletes all associated shapes and joints. * @warning This function is locked during callbacks. */ public void destroyBody (Body body) { Array<JointEdge> jointList = body.getJointList(); while (jointList.size > 0) destroyJoint(body.getJointList().get(0).joint); jniDestroyBody(addr, body.addr); body.setUserData(null); this.bodies.remove(body.addr); Array<Fixture> fixtureList = body.getFixtureList(); while(fixtureList.size > 0) { Fixture fixtureToDelete = fixtureList.removeIndex(0); this.fixtures.remove(fixtureToDelete.addr).setUserData(null); freeFixtures.free(fixtureToDelete); } freeBodies.free(body); }