Control aniamtion wrong

Can anyone assist the simpler implimentation I have for everything has left my models animating incorrectly during input.



I would like the model to animate only if moving It was okay before when I used physics to check its velocity(kind of ) however now moveforward() is called if i'm moving left, forward sometimes back, and moveRight() is called when i'm moving right back and sometime left can anyone assist?


public void update(float time) {
      
      if(player.getOffGround()==true){moveForward(null);}
      else if(!location.equals(player.getRootNode().getLocalTranslation()))
      {   Vector3f direction = new Vector3f();
              if(location.getZ()>player.getRootNode().getLocalTranslation().getZ())moveForward(null);
         else if(location.getZ()<player.getRootNode().getLocalTranslation().getZ())moveBackward(null);
         else if(location.getX()>player.getRootNode().getLocalTranslation().getX())strafeLeft(null);
         else if(location.getX()<player.getRootNode().getLocalTranslation().getX())strafeRight(null);
              System.out.println("location "+location);
             System.out.println("player "+player.getRootNode().getLocalTranslation());
      }else idle(null);
   location.set(player.getRootNode().getLocalTranslation());
   

   }
   private Vector3f location = new Vector3f();



doesn't work either


Vector3f direction = player.getRootNode().getLocalTranslation();
              if(location.subtract(direction).getZ()>0)moveForward(null);
         else if(location.subtract(direction).getZ()<0)moveBackward(null);
         else if(location.subtract(direction).getX()>0)strafeLeft(null);
         else if(location.subtract(direction).getX()<0)strafeRight(null);