Skip to content

Commit

Permalink
Added a hard yaw reset when the minion reaches the target
Browse files Browse the repository at this point in the history
  • Loading branch information
casals committed Aug 10, 2019
1 parent cd0e7b3 commit f373898
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/java/org/terasology/minion/move/MoveToAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,16 +81,18 @@ private boolean processDirect(Actor actor, MinionMoveComponent moveComponent) {
Vector3f drive = new Vector3f();

float yaw = (float) Math.atan2(targetDirection.x, targetDirection.z);
float requestedYaw = 180f + yaw * TeraMath.RAD_TO_DEG;


if((targetDirection.x < distance) && (targetDirection.y < distance) && (targetDirection.z < distance)) {
drive.set(0, 0, 0);
reachedTarget = true;
requestedYaw = 0f;
} else {
targetDirection.normalize();
drive.set(targetDirection);
}

float requestedYaw = 180f + yaw * TeraMath.RAD_TO_DEG;

CharacterMoveInputEvent wantedInput = new CharacterMoveInputEvent(0, 0, requestedYaw, drive, false, false, moveComponent.jumpMode, (long) (actor.getDelta() * 1000));
actor.getEntity().send(wantedInput);

Expand Down

0 comments on commit f373898

Please sign in to comment.