Skip to content

PrioritySteeringBehavior

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

Definition

PrioritySteeringBehavior iterates through the behaviors provided via list parameter and finds the first behavior which requests an acceleration greater than threshold. For instance, the HideBehavior will request acceleration only in certain cases. When it does request an acceleration it should be more prioritized than the other ones in case the steerable must hide from another steerable. PrioritySteeringBehavior allows us to combine behaviors in a way that we can still prioritize certain behaviors.

Usage

// create an instance of PrioritySteeringBehavior
var prioritySteeringBehavior = new Kompute.PrioritySteeringBehavior({
  // put some behaviors we'd like to combine into the list
  list: [new Kompute.SteeringBehavior(), new Kompute.SteeringBehavior()],
  threshold: 10
});

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

// set PrioritySteeringBehavior
steerable.setBehavior(prioritySteeringBehavior);

Clone this wiki locally