-
Notifications
You must be signed in to change notification settings - Fork 4
Steerable
Oğuz Eroğlu edited this page Jun 17, 2020
·
5 revisions
Steerable
is a specific type of Entity which can be controlled by steering behaviors. Steerables may move and jump depending on their behaviors.
Steerables need to be inserted into a world in order to be controlled by steering behaviors.
// create a world
var world = new Kompute.World(1000, 1000, 1000, 10);
// create a steerable
// steerable will be created at (0, 0, 0)
var centerPosition = new Kompute.Vector3D();
// steerable has a size of 50x50x50
var size = new Kompute.Vector3D(50, 50, 50);
// steerable will have "steerable1" as ID.
var steerable = new Kompute.Steerable("steerable1", centerPosition, size);
// insert the steerable into the world
world.insertEntity(steerable);
// set the behavior of the steerable
steerable.setBehavior(new Kompute.SteeringBehavior());
// set the max speed, acceleration of the steerable
steerable.maxSpeed = 1000;
steerable.maxAcceleration = 100;
// update the steerable ideally 60 times per second
function update() {
// update the steerable
steerable.update();
// steerable.position => A Vector3D that holds the updated position of the steerable.
// steerable.velocity => A Vector3D that holds the updated velocity of the steerable.
// call the update function next frame
requestAnimationFrame(update);
}
update();
// to update the position of the steerable
var newPosition = new Kompute.Vector3D(0, 30, 0);
steerable.setPosition(newPosition);
- 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