Program: 28032
Project: 28032
Buggy source:
@Override public void create(Table table){
  Jump.DEBUG_ENABLED=true;
  drawDebug=true;
  shapeRenderer=new ShapeRenderer();
  spriteBatch=new SpriteBatch();
  world=createWorld(-9.81f);
  setContactListener();
  PolygonShape groundPoly=new PolygonShape();
  groundPoly.setAsBox(Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_HEIGHT));
  BodyDef groundBodyDef=new BodyDef();
  groundBodyDef.type=BodyType.StaticBody;
  groundBodyDef.position.set(Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_Y));
  leftPlatform=world.createBody(groundBodyDef);
  groundBodyDef.position.set(Box2dSteeringTest.pixelsToMeters((int)container.stageWidth - PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_Y));
  rightPlatform=world.createBody(groundBodyDef);
  FixtureDef fixtureDef=new FixtureDef();
  fixtureDef.shape=groundPoly;
  fixtureDef.filter.groupIndex=0;
  leftPlatform.createFixture(fixtureDef);
  rightPlatform.createFixture(fixtureDef);
  groundPoly.dispose();
  character=createSteeringEntity(world,container.badlogicSmall,true);
  character.setMaxLinearSpeed(4);
  character.setMaxLinearAcceleration(200);
  Vector2 takeoffPoint=new Vector2(leftPlatform.getPosition()).add(Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_WIDTH - 20),Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_HEIGHT) + character.getBoundingRadius());
  Vector2 landingPoint=new Vector2(rightPlatform.getPosition()).add(Box2dSteeringTest.pixelsToMeters(20 - PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_HEIGHT) + character.getBoundingRadius());
  System.out.println("String_Node_Str" + takeoffPoint);
  System.out.println("String_Node_Str" + landingPoint);
  jumpDescriptor=new JumpDescriptor<Vector2>(takeoffPoint,landingPoint);
  JumpCallback jumpCallback=new JumpCallback(){
    JumpDescriptor<Vector2> newJumpDescriptor=new JumpDescriptor<Vector2>(new Vector2(),new Vector2());
    @Override public void reportAchievability(    boolean achievable){
      System.out.println("String_Node_Str" + achievable);
    }
    @Override public void takeoff(    float maxVerticalVelocity,    float time){
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str" + character.getLinearVelocity() + "String_Node_Str"+ character.getLinearVelocity().len());
      float h=maxVerticalVelocity * maxVerticalVelocity / (-2f * jumpSB.getGravity().y);
      System.out.println("String_Node_Str" + h);
switch (airbornePlanarVelocityToUse) {
case 0:
        character.getBody().setLinearVelocity(character.getBody().getLinearVelocity().add(0,maxVerticalVelocity));
      break;
case 1:
    Vector2 targetLinearVelocity=jumpSB.getTarget().getLinearVelocity();
  character.getBody().setLinearVelocity(newJumpDescriptor.takeoffPosition.set(targetLinearVelocity.x,maxVerticalVelocity));
break;
case 2:
Vector2 newLinearVelocity=character.getBody().getLinearVelocity();
newJumpDescriptor.set(character.getPosition(),jumpSB.getJumpDescriptor().landingPosition);
System.out.println("String_Node_Str" + character.getPosition());
time=jumpSB.calculateAirborneTimeAndVelocity(newLinearVelocity,newJumpDescriptor,jumpSB.getLimiter().getMaxLinearSpeed());
character.getBody().setLinearVelocity(newLinearVelocity.add(0,maxVerticalVelocity));
break;
}
character.setSteeringBehavior(null);
}
}
;
jumpSB=new Jump<Vector2>(character,jumpDescriptor,world.getGravity(),GRAVITY_COMPONENT_HANDLER,jumpCallback).setMaxVerticalVelocity(5).setTakeoffPositionTolerance(.3f).setTakeoffVelocityTolerance(.7f).setTimeToTarget(.01f);
jumpSB.setLimiter(new LinearLimiter(Float.POSITIVE_INFINITY,character.getMaxLinearSpeed() * 3));
seekSB=new Seek<Vector2>(character,new SteerableAdapter<Vector2>(){
Vector2 pos=new Vector2(jumpDescriptor.landingPosition).add(1000,0);
@Override public Vector2 getPosition(){
return pos;
}
}
);
restart();
Table detailTable=new Table(container.skin);
detailTable.row();
final Label labelRunUpLenght=new Label("String_Node_Str" + runUpLength + "String_Node_Str",container.skin);
detailTable.add(labelRunUpLenght);
detailTable.row();
Slider sliderRunUpLenght=new Slider(0.1f,4f,0.1f,false,container.skin);
sliderRunUpLenght.setValue(runUpLength);
sliderRunUpLenght.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
runUpLength=slider.getValue();
labelRunUpLenght.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(sliderRunUpLenght);
detailTable.row();
final Label labelTakeoffPosTol=new Label("String_Node_Str" + jumpSB.getTakeoffPositionTolerance() + "String_Node_Str",container.skin);
detailTable.add(labelTakeoffPosTol);
detailTable.row();
Slider takeoffPosTol=new Slider(0.01f,1f,0.01f,false,container.skin);
takeoffPosTol.setValue(jumpSB.getTakeoffPositionTolerance());
takeoffPosTol.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
jumpSB.setTakeoffPositionTolerance(slider.getValue());
labelTakeoffPosTol.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(takeoffPosTol);
detailTable.row();
final Label labelTakeoffVelTol=new Label("String_Node_Str" + jumpSB.getTakeoffVelocityTolerance() + "String_Node_Str",container.skin);
detailTable.add(labelTakeoffVelTol);
detailTable.row();
Slider takeoffVelTol=new Slider(0.01f,1f,0.01f,false,container.skin);
takeoffVelTol.setValue(jumpSB.getTakeoffVelocityTolerance());
takeoffVelTol.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
jumpSB.setTakeoffVelocityTolerance(slider.getValue());
labelTakeoffVelTol.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(takeoffVelTol);
detailTable.row();
final Label labelMaxVertVel=new Label("String_Node_Str" + jumpSB.getMaxVerticalVelocity() + "String_Node_Str",container.skin);
detailTable.add(labelMaxVertVel);
detailTable.row();
Slider maxVertVel=new Slider(1f,15f,0.5f,false,container.skin);
maxVertVel.setValue(jumpSB.getMaxVerticalVelocity());
maxVertVel.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
jumpSB.setMaxVerticalVelocity(slider.getValue());
labelMaxVertVel.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(maxVertVel);
detailTable.row();
addSeparator(detailTable);
detailTable.row();
final Label labelJumpVel=new Label("String_Node_Str",container.skin);
detailTable.add(labelJumpVel);
detailTable.row();
SelectBox<String> jumpVel=new SelectBox<String>(container.skin);
jumpVel.setItems(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
jumpVel.setSelectedIndex(0);
jumpVel.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
@SuppressWarnings("String_Node_Str") SelectBox<String> selectBox=(SelectBox<String>)actor;
airbornePlanarVelocityToUse=selectBox.getSelectedIndex();
}
}
);
detailTable.add(jumpVel);
detailTable.row();
addSeparator(detailTable);
detailTable.row();
addMaxLinearAccelerationController(detailTable,character);
detailTable.row();
addMaxLinearSpeedController(detailTable,character);
detailTable.row();
addSeparator(detailTable);
detailTable.row();
Button buttonRestart=new TextButton("String_Node_Str",container.skin);
buttonRestart.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
restart();
}
}
);
detailTable.add(buttonRestart);
detailWindow=createDetailWindow(detailTable);
}

Fixed version (ground truth):
@Override public void create(Table table){
  Jump.DEBUG_ENABLED=true;
  drawDebug=true;
  shapeRenderer=new ShapeRenderer();
  spriteBatch=new SpriteBatch();
  world=createWorld(-9.81f);
  setContactListener();
  PolygonShape groundPoly=new PolygonShape();
  groundPoly.setAsBox(Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_HEIGHT));
  BodyDef groundBodyDef=new BodyDef();
  groundBodyDef.type=BodyType.StaticBody;
  groundBodyDef.position.set(Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_Y));
  leftPlatform=world.createBody(groundBodyDef);
  groundBodyDef.position.set(Box2dSteeringTest.pixelsToMeters((int)container.stageWidth - PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_Y));
  rightPlatform=world.createBody(groundBodyDef);
  FixtureDef fixtureDef=new FixtureDef();
  fixtureDef.shape=groundPoly;
  fixtureDef.filter.groupIndex=0;
  leftPlatform.createFixture(fixtureDef);
  rightPlatform.createFixture(fixtureDef);
  groundPoly.dispose();
  character=createSteeringEntity(world,container.badlogicSmall,true);
  character.setMaxLinearSpeed(4);
  character.setMaxLinearAcceleration(40);
  Vector2 takeoffPoint=new Vector2(leftPlatform.getPosition()).add(Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_WIDTH - 20),Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_HEIGHT) + character.getBoundingRadius());
  Vector2 landingPoint=new Vector2(rightPlatform.getPosition()).add(Box2dSteeringTest.pixelsToMeters(20 - PLATFORM_HALF_WIDTH),Box2dSteeringTest.pixelsToMeters(PLATFORM_HALF_HEIGHT) + character.getBoundingRadius());
  System.out.println("String_Node_Str" + takeoffPoint);
  System.out.println("String_Node_Str" + landingPoint);
  jumpDescriptor=new JumpDescriptor<Vector2>(takeoffPoint,landingPoint);
  JumpCallback jumpCallback=new JumpCallback(){
    JumpDescriptor<Vector2> newJumpDescriptor=new JumpDescriptor<Vector2>(new Vector2(),new Vector2());
    @Override public void reportAchievability(    boolean achievable){
      System.out.println("String_Node_Str" + achievable);
    }
    @Override public void takeoff(    float maxVerticalVelocity,    float time){
      System.out.println("String_Node_Str");
      System.out.println("String_Node_Str" + character.getLinearVelocity() + "String_Node_Str"+ character.getLinearVelocity().len());
      float h=maxVerticalVelocity * maxVerticalVelocity / (-2f * jumpSB.getGravity().y);
      System.out.println("String_Node_Str" + h);
switch (airbornePlanarVelocityToUse) {
case 0:
        character.getBody().setLinearVelocity(character.getBody().getLinearVelocity().add(0,maxVerticalVelocity));
      break;
case 1:
    Vector2 targetLinearVelocity=jumpSB.getTarget().getLinearVelocity();
  character.getBody().setLinearVelocity(newJumpDescriptor.takeoffPosition.set(targetLinearVelocity.x,maxVerticalVelocity));
break;
case 2:
Vector2 newLinearVelocity=character.getBody().getLinearVelocity();
newJumpDescriptor.set(character.getPosition(),jumpSB.getJumpDescriptor().landingPosition);
System.out.println("String_Node_Str" + character.getPosition());
time=jumpSB.calculateAirborneTimeAndVelocity(newLinearVelocity,newJumpDescriptor,jumpSB.getLimiter().getMaxLinearSpeed());
character.getBody().setLinearVelocity(newLinearVelocity.add(0,maxVerticalVelocity));
break;
}
character.setSteeringBehavior(null);
}
}
;
jumpSB=new Jump<Vector2>(character,jumpDescriptor,world.getGravity(),GRAVITY_COMPONENT_HANDLER,jumpCallback).setMaxVerticalVelocity(5).setTakeoffPositionTolerance(.3f).setTakeoffVelocityTolerance(.7f).setTimeToTarget(.1f);
jumpSB.setLimiter(new LinearLimiter(Float.POSITIVE_INFINITY,character.getMaxLinearSpeed() * 3));
seekSB=new Seek<Vector2>(character,new SteerableAdapter<Vector2>(){
Vector2 pos=new Vector2(jumpDescriptor.landingPosition).add(1000,0);
@Override public Vector2 getPosition(){
return pos;
}
}
);
restart();
Table detailTable=new Table(container.skin);
detailTable.row();
final Label labelRunUpLenght=new Label("String_Node_Str" + runUpLength + "String_Node_Str",container.skin);
detailTable.add(labelRunUpLenght);
detailTable.row();
Slider sliderRunUpLenght=new Slider(0.1f,4f,0.1f,false,container.skin);
sliderRunUpLenght.setValue(runUpLength);
sliderRunUpLenght.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
runUpLength=slider.getValue();
labelRunUpLenght.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(sliderRunUpLenght);
detailTable.row();
final Label labelTakeoffPosTol=new Label("String_Node_Str" + jumpSB.getTakeoffPositionTolerance() + "String_Node_Str",container.skin);
detailTable.add(labelTakeoffPosTol);
detailTable.row();
Slider takeoffPosTol=new Slider(0.01f,1f,0.01f,false,container.skin);
takeoffPosTol.setValue(jumpSB.getTakeoffPositionTolerance());
takeoffPosTol.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
jumpSB.setTakeoffPositionTolerance(slider.getValue());
labelTakeoffPosTol.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(takeoffPosTol);
detailTable.row();
final Label labelTakeoffVelTol=new Label("String_Node_Str" + jumpSB.getTakeoffVelocityTolerance() + "String_Node_Str",container.skin);
detailTable.add(labelTakeoffVelTol);
detailTable.row();
Slider takeoffVelTol=new Slider(0.01f,1f,0.01f,false,container.skin);
takeoffVelTol.setValue(jumpSB.getTakeoffVelocityTolerance());
takeoffVelTol.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
jumpSB.setTakeoffVelocityTolerance(slider.getValue());
labelTakeoffVelTol.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(takeoffVelTol);
detailTable.row();
final Label labelMaxVertVel=new Label("String_Node_Str" + jumpSB.getMaxVerticalVelocity() + "String_Node_Str",container.skin);
detailTable.add(labelMaxVertVel);
detailTable.row();
Slider maxVertVel=new Slider(1f,15f,0.5f,false,container.skin);
maxVertVel.setValue(jumpSB.getMaxVerticalVelocity());
maxVertVel.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
Slider slider=(Slider)actor;
jumpSB.setMaxVerticalVelocity(slider.getValue());
labelMaxVertVel.setText("String_Node_Str" + slider.getValue() + "String_Node_Str");
}
}
);
detailTable.add(maxVertVel);
detailTable.row();
addSeparator(detailTable);
detailTable.row();
final Label labelJumpVel=new Label("String_Node_Str",container.skin);
detailTable.add(labelJumpVel);
detailTable.row();
SelectBox<String> jumpVel=new SelectBox<String>(container.skin);
jumpVel.setItems(new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"});
jumpVel.setSelectedIndex(0);
jumpVel.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
@SuppressWarnings("String_Node_Str") SelectBox<String> selectBox=(SelectBox<String>)actor;
airbornePlanarVelocityToUse=selectBox.getSelectedIndex();
}
}
);
detailTable.add(jumpVel);
detailTable.row();
addSeparator(detailTable);
detailTable.row();
addMaxLinearAccelerationController(detailTable,character);
detailTable.row();
addMaxLinearSpeedController(detailTable,character);
detailTable.row();
addSeparator(detailTable);
detailTable.row();
Button buttonRestart=new TextButton("String_Node_Str",container.skin);
buttonRestart.addListener(new ChangeListener(){
@Override public void changed(ChangeEvent event,Actor actor){
restart();
}
}
);
detailTable.add(buttonRestart);
detailWindow=createDetailWindow(detailTable);
}