-
Notifications
You must be signed in to change notification settings - Fork 5
PathFollowingBehavior
Oğuz Eroğlu edited this page Aug 9, 2020
·
4 revisions
This demo includes this behavior for the user-controlled character.
PathFollowingBehavior
makes a steerable follow a path
by making it seek towards each waypoint of the path respectively. The steerable is considered to reach to a certain waypoint if the distance between its position and the waypoint position is less than satisfactionRadius
. It then seeks toward the next waypoint, until the path is finished (if it's not a looping path).
If a jump descriptor is added to given path, this behavior automatically initiates a jump when the jump take off position is on the way. In that case, the steerable automatically continues with the PathFollowingBehavior
when the jump is completed (the steerable landed to the landing position).
// create a Steerable
var steerable = new Kompute.Steerable("steerable1", new Kompute.Vector3D(), new Kompute.Vector3D(10, 10, 10));
// set max speed and acceleration of the Steerable
steerable.maxSpeed = 100;
steerable.maxAcceleration = 100;
// Create a Path
var path = new Kompute.Path();
path.addWaypoint(new Kompute.Vector3D(0, 0, 0));
path.addWaypoint(new Kompute.Vector3D(100, 200, 300));
// Create an instance of PathFollowingBehavior
var pathFollowingBehavior = new Kompute.PathFollowingBehavior({ path: path, satisfactionRadius: 50 });
// set the behavior
steerable.setBehavior(pathFollowingBehavior);
// listen to path finish if necessary
path.finishCallback = function(){
console.log("Path is finished.");
};
- Core
- Path
-
Steering Behaviors
- AlignBehavior
- ArriveBehavior
- AvoidBehavior
- BlendedSteeringBehavior
- CohesionBehavior
- EvadeBehavior
- FleeBehavior
- HideBehavior
- JumpBehavior
- LookWhereYouAreGoingBehavior
- PathFollowingBehavior
- PrioritySteeringBehavior
- PursueBehavior
- RandomPathBehavior
- RandomWaypointBehavior
- SeekBehavior
- SeparationBehavior
- Wander2DBehavior
- Wander3DBehavior
- Math
- Extra