So I observe the unique gdx-ai documentation and created 2 circles to check Steering conduct.

The picture exhibits arrival behaviour however I’m nonetheless fairly misplaced about how they work.
Display screen class:
public void present() {
pCircle = new ShapeRenderer();
pCircle.setProjectionMatrix(mCamera.mixed);
sCircle = new SteeringCircle(pCircle, 15, 128*5, 128, Shade.BLUE);
goal = new SteeringCircle(pCircle, 15, 128,128*3 , Shade.CYAN);
/*
Wander<Vector2> wanderSB = new Wander<Vector2>(sCircle);
wanderSB.setEnabled(true);
wanderSB.setTarget(goal);*/
Arrive<Vector2> arriveSB = new Arrive<Vector2>(sCircle, goal).setTimeToTarget(0.1f).setArrivalTolerance(10f).setDecelerationRadius(25f);
sCircle.setBehavior(arriveSB);
}
@Override
public void render(float delta) {
Gdx.gl.glClearColor(63 / 255f, 128 / 255f, 70 / 255f, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
mCamera.replace();
mTiledMapRenderer.setView(mCamera);
mTiledMapRenderer.render();
sCircle.replace(delta);
sCircle.render();
goal.render();
mBatch.setProjectionMatrix(mCamera.mixed);
mBatch.start();
mBatch.draw(img, 128, 0);
mBatch.finish();
}
SteeringCircle class:
public SteeringCircle(ShapeRenderer circle ,float boundingRadius, float x, float y, Shade shade) {
pCircle = circle;
mColor = shade;
this.place = newVector();
this.place.x = x;
this.place.y = y;
this.boundingRadius = boundingRadius;
this.maxLinearSpeed = 50;
this.maxLinearAcceleration = 5000;
this.linearVelocity = new Vector2(15,15);
this.maxAngularSpeed = 30;
this.maxLinearAcceleration = 5;
this.tagged = false;
this.steeringOutput = new SteeringAcceleration<Vector2>(new Vector2());
}
@Override
public Location<Vector2> newLocation() {
return null;
}
public void replace (float delta) {
if (steeringBehavior != null) {
// Calculate steering acceleration
steeringBehavior.calculateSteering(steeringOutput);
// Apply steering acceleration to maneuver this agent
applySteering(steeringOutput, delta);
}
}
personal void applySteering (SteeringAcceleration<Vector2> steering, float time) {
// Replace place and linear velocity. Velocity is trimmed to most pace
this.place.mulAdd(linearVelocity, time);
this.linearVelocity.mulAdd(steering.linear, time).restrict(this.getMaxLinearSpeed());
// Replace orientation and angular velocity
if (independentFacing) {
this.orientation += angularVelocity * time;
this.angularVelocity += steering.angular * time;
} else {
// For non-independent going through we have now to align orientation to linear velocity
float newOrientation = calculateOrientationFromLinearVelocity(this);
if (newOrientation != this.orientation) {
this.angularVelocity = (newOrientation - this.orientation) * time;
this.orientation = newOrientation;
}
}
}
-
For the arrival behaviour, the blue circle will transfer from the unique place in the direction of the Cyan circle and comes again to the circle backwards and forwards. I believed the blue circle is meant to cease when arriving the cyan circle which it did not. How can I make it cease at arrival? what’s flawed with the codes?
-
For the wander behaviour, the blue circle simply strikes north-east route and by no means goes again to the cyan circle. I believed it is going to wander round however it did not. Any recommendation on what is required to vary to make the wander behaviour occurs?
Additionally, does anybody know what ought to Location returns? Is not Vector2 place already has the placement?


