gdx-ai: how to disable behaviour

110 Views Asked by At

From yesterday I was looking for a way to disable some behaviour in Gdx-Ai, I wrote code like this:

arriveSteeringBehaviour = new Arrive<Vector3>(character, MainCharacter.getTarget()) //
                .setTimeToTarget(0.1f)
                .setArrivalTolerance(0.0002f)
                .setDecelerationRadius(8);

arriveSteeringBehaviour.setEnabled(true);
character.setSteeringBehavior(arriveSteeringBehaviour);

when "Arrive Distance" <= "Deceleration Radius" I'm trying to disable the Arrive Behaviour like this

if (arriveSteeringBehaviour.getDistance() <= arriveSteeringBehaviour.getDecelerationRadius() ) {
    arriveSteeringBehaviour.setEnabled(false);
    character.setSteeringBehavior(null);
}

but it's doesn't worked, character object still moving around, anyone can figure this out? thanks

note: in update method, I did disable any translation also disabled character.update(GdxAI.getTimepiece().getDeltaTime()); line.

0

There are 0 best solutions below