Skip to content

Commit

Permalink
enemy stops at HidingSpot
Browse files Browse the repository at this point in the history
  • Loading branch information
robp94 committed Feb 10, 2019
1 parent 325edfe commit 08f62e6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion examples/misc/hideAndSeek/src/HideBehavior.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,16 @@ class HideBehavior extends SteeringBehavior {
this._path.clear();
this._arrive.deceleration = this.deceleration;
this._arrive.target = this._bestHidingSpot;
this._arrive.calculate( vehicle, force );

if ( ! ( this._bestHidingSpot.squaredDistanceTo( vehicle.position ) < 0.5 ) ) {

this._arrive.calculate( vehicle, force );

} else {

vehicle.velocity.set( 0, 0, 0 );

}

}

Expand Down

0 comments on commit 08f62e6

Please sign in to comment.