Skip to content

Commit

Permalink
Changed how reachTarget flag is raised in MoveTo minion action
Browse files Browse the repository at this point in the history
Reverting module.txt from debug settings

Changed how reachTarget flag is raised in MoveTo minion action
  • Loading branch information
casals committed Aug 10, 2019
1 parent 00cefae commit cd0e7b3
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/main/java/org/terasology/minion/move/MoveToAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,15 @@ private boolean processDirect(Actor actor, MinionMoveComponent moveComponent) {
targetDirection.sub(moveComponent.target, worldPos);
Vector3f drive = new Vector3f();

// TODO review - is the yaw here being calculated properly?
float yaw = (float) Math.atan2(targetDirection.x, targetDirection.z);

if (targetDirection.x * targetDirection.x + targetDirection.z * targetDirection.z <= distance * distance) {
if((targetDirection.x < distance) && (targetDirection.y < distance) && (targetDirection.z < distance)) {
drive.set(0, 0, 0);
reachedTarget = true;
} 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));
Expand Down

0 comments on commit cd0e7b3

Please sign in to comment.