Skip to content

ArriveBehavior

Oğuz Eroğlu edited this page Aug 3, 2020 · 4 revisions

Demo

Available here.

Definition

ArriveBehavior makes a steerable arrive to a target position. The steerable goes towards the target position with maximum speed until it is slowDownRadius units away from the target. Once it reaches there, it then slows down until it is satisfactionRadius units away from the target. It then stops.

Usage

// create an instance of ArriveBehavior
var arriveBehavior = new Kompute.ArriveBehavior({
  satisfactionRadius: 5,
  slowDownRadius: 50
});

// create a steerable at (0, 0, 0) of size (50, 50, 50)
var steerable = new Kompute.Steerable("steerable1", new Kompute.Vector3D(), new Kompute.Vector3D(50, 50, 50));

// set the max velocity and acceleration of steerable
steerable.maxSpeed = 1000;
steerable.maxAcceleration = 100;

// set ArriveBehavior
steerable.setBehavior(arriveBehavior);

// set a target position to steerable
steerable.setTargetPosition(new Kompute.Vector3D(100, 200, 300));

Clone this wiki locally