Skip to content

Instantly share code, notes, and snippets.

@IQAndreas
Created March 19, 2013 21:14
Show Gist options
  • Save IQAndreas/5200218 to your computer and use it in GitHub Desktop.
Save IQAndreas/5200218 to your computer and use it in GitHub Desktop.
Seek and Flee steering behaviors using OpenSteer ("orbiting" result)
// function init()
seekVehicle = new SimpleVehicle();
seekVehicle.setPosition(Math.random() * displayWidth, 0, Math.random() * displayHeight);
seekVehicle.radius = 10;
seekVehicle.maxForce = 800.0; //steering force
seekVehicle.maxSpeed = 300.0; //velocity
seekVehicle.speed = 100;
seekBoid = this.addBoid(seekVehicle, 0x00CC00);
// function update(currentTime:Number, elapsedTime:Number)
var seekVec:Vector3 = seekVehicle.steerForSeek(target.getVector3());
seekVehicle.applySteeringForce(seekVec, elapsedTime);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment