/** Test a point for containment in this fixture. * @param p a point in world coordinates. */ public boolean testPoint (Vector2 p) { tmp.set(p.x, p.y); return fixture.testPoint(tmp); }
/** Test a point for containment in this fixture. * @param x the x-coordinate * @param y the y-coordinate */ public boolean testPoint (float x, float y) { tmp.set(x, y); return fixture.testPoint(tmp); }
public boolean reportFixture(Fixture argFixture) { Body body = argFixture.getBody(); if (body.getType() == BodyType.DYNAMIC) { boolean inside = argFixture.testPoint(point); if (inside) { fixture = argFixture; return false; } } return true; } }
QueryCallback callback = new QueryCallback() { @Override public boolean reportFixture (Fixture fixture) { if (fixture.testPoint(point.x, point.y)) { bodyThatWasHit = fixture.getBody(); return false; } else return true; } };
public boolean reportFixture(Fixture argFixture) { Body body = argFixture.getBody(); if (body.getType() == BodyType.DYNAMIC) { boolean inside = argFixture.testPoint(point); if (inside) { fixture = argFixture; return false; } } return true; } }
@Override public boolean reportFixture(Fixture fixture) { if(fixture.getBody() == chest){ //add to remove list bodiesToRemove.add(chest); } if (fixture.testPoint(tmp.x, tmp.y)){ reportFixture = fixture.getBody(); } if (!fixture.testPoint(tmp.x, tmp.y)) return false; //assigning bodyB to fixture jointDef.bodyB = fixture.getBody(); jointDef.target.set(fixture.getBody().getWorldCenter()); //jointDef.target.set(tmp.x, tmp.y); joint = (MouseJoint) world.createJoint(jointDef); return false; }
Vector3 testPoint = new Vector3(); QueryCallback callback = new QueryCallback() { @Override public boolean reportFixture(Fixture fixture) { if(fixture.testPoint(testPoint.x,testPoint.y)){ hitBody = fixture.getBody(); return false; }else{ return true; } } }; @Override public boolean touchDown(int screenX, int screenY, int pointer, int button) { GameRender.cam.unproject(testPoint.set(screenX,screenY,0)); hitBody = null; GameWorld.physicsWorld.QueryAABB(callback, testPoint.x - 0.0001f, testPoint.y - 0.0001f, testPoint.x + 0.0001f, testPoint.y + 0.0001f); for(DynamicBox b:GameWorld.BoxList){ if(hitBody == b.boxerino){ System.out.println("click detected"); b.shouldRemove = true; } } return false; }
if (fixture.testPoint(testPoint.x, testPoint.y)) { tempBody = fixture.getBody(); return false;