Skip to content

FleeBehavior

Oğuz Eroğlu edited this page Jun 8, 2020 · 1 revision

Definition

FleeBehavior makes a steerable goes away from a target position with its maximum acceleration. This behavior produces the inverse of what SeekBehavior produces.

Usage

// create an instance of FleeBehavior
var fleeBehavior = new Kompute.FleeBehavior();

// 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 FleeBehavior
steerable.setBehavior(fleeBehavior);

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

Clone this wiki locally