|
@@ -530,7 +530,7 @@ if (spatial == null) {
|
|
[source, java]
|
|
[source, java]
|
|
----
|
|
----
|
|
//Computes a path using the A* algorithm. Every 1/2 second checks target
|
|
//Computes a path using the A* algorithm. Every 1/2 second checks target
|
|
-//for processing. Path will remain untill a new path is generated.
|
|
|
|
|
|
+//for processing. Path will remain until a new path is generated.
|
|
private void startPathFinder() {
|
|
private void startPathFinder() {
|
|
executor.scheduleWithFixedDelay(() -> {
|
|
executor.scheduleWithFixedDelay(() -> {
|
|
if (target != null) {
|
|
if (target != null) {
|
|
@@ -648,7 +648,7 @@ public void update(float tpf) {
|
|
Vector2f waypoint2D = new Vector2f(getWayPosition().x,
|
|
Vector2f waypoint2D = new Vector2f(getWayPosition().x,
|
|
getWayPosition().z);
|
|
getWayPosition().z);
|
|
float distance = aiPosition.distance(waypoint2D);
|
|
float distance = aiPosition.distance(waypoint2D);
|
|
- //move char between waypoints untill waypoint reached then set null
|
|
|
|
|
|
+ //move char between waypoints until waypoint reached then set null
|
|
if (distance > .25f) {
|
|
if (distance > .25f) {
|
|
Vector2f direction = waypoint2D.subtract(aiPosition);
|
|
Vector2f direction = waypoint2D.subtract(aiPosition);
|
|
direction.mult(tpf);
|
|
direction.mult(tpf);
|
|
@@ -723,7 +723,7 @@ If it's greater than the distance specified, it will `setViewDirection()` of the
|
|
----
|
|
----
|
|
if (getWayPosition() != null) {
|
|
if (getWayPosition() != null) {
|
|
...
|
|
...
|
|
- //move char between waypoints untill waypoint reached then set null
|
|
|
|
|
|
+ //move char between waypoints until waypoint reached then set null
|
|
if (distance > .25f) {
|
|
if (distance > .25f) {
|
|
Vector2f direction = waypoint2D.subtract(aiPosition);
|
|
Vector2f direction = waypoint2D.subtract(aiPosition);
|
|
direction.mult(tpf);
|
|
direction.mult(tpf);
|