// Gerneral function void setupPlayerControl() { this.animControl = ((Node) spatial).getChild("PlayerMesh").getControl(AnimControl.class); animChannel = animControl.createChannel(); if (playerInfo.getRole().equals(PlayerRole.GoalKeeper)) { animChannel.setAnim("Idle"); chasingBall = false; } else { animChannel.setAnim("RunFast"); chasingBall = true; } }
void moveTo(Vector3f pos) { float speed = playerInfo.getRealSpeed(); Vector3f location = spatial.getLocalTranslation(); Vector3f target = pos.clone(); Vector3f distance = target.subtract(location); if (distance.length() < 0.3f) { return; } Vector3f newVel = distance.normalize().mult(speed); // Vector3f steering = desierdVel.subtract(velocity).negate(); spatial.setLocalTranslation(location.add(newVel)); }