Skip to main content

steering_engine 0.2.0 copy "steering_engine: ^0.2.0" to clipboard
steering_engine: ^0.2.0 copied to clipboard

Composable 2D steering behaviors in pure Dart, with local and flocking behaviors, waypoint paths, static circle avoidance and bounded motion integration.

example/steering_engine_example.dart

import 'package:steering_engine/steering_engine.dart';

void main() {
  const engine = SteeringEngine();
  var agent =
      SteeringAgent(position: Vec2.zero, maxSpeed: 80, maxAcceleration: 160);
  final behavior = Arrive(Vec2(200, 100), slowingRadius: 80);
  for (var frame = 0; frame < 600; frame++) {
    agent = engine.step(agent, behavior, 1 / 60);
  }
  print('Position: ${agent.position}');
  print('Speed: ${agent.velocity.length.toStringAsFixed(3)}');
  if ((agent.position - behavior.target).length > 2) {
    throw StateError('Agent did not reach the arrival region');
  }
}
1
likes
160
points
101
downloads

Documentation

API reference

Publisher

verified publisherkleberandrade.dev

Weekly Downloads

Composable 2D steering behaviors in pure Dart, with local and flocking behaviors, waypoint paths, static circle avoidance and bounded motion integration.

Repository (GitHub)
View/report issues
Contributing

Topics

#steering #game-development #simulation #artificial-intelligence #dart

License

MIT (license)

More

Packages that depend on steering_engine