Steering behaviors: Updated, now with obstacle avoidance

Download

Updated 9 Feb 2007, added collision avoidance (avoid other moving vehicles).

Update: screenshot and movie.

Updated 5 Feb 2007, added obstacle avoidance.

Demonstration of steering behaviors implemented in Panda, based on Craig Reynold’s steering behaviors site and on OpenSteer. The code is object oriented, designed to be extensible and easy to integrate with your own code.

There are five modules in the download:

  • camera.py – a controllable camera. Very useful.
  • draw.py – a library of primitive drawing functions (lines, circles, rectangles, grid, reticles etc) built on top of Panda’s LineSegs class. Useful for quickly throwing together a test environment for your code.
  • steerVec.py – an extension of Panda’s Vec2 class with some extra methods needed for steering behaviors
  • vehicle.py – a steerable vehicle with simple 2D physics (acceleration and momentum) and a variety of steering behaviors.
  • steerDemo.py – this is the file you should run, it’s a graphical demo of the steering behaviors implemented in vehicle.py

Still to do:

  • Obstacle and vehicle avoidance steering behaviors Update: done
  • Combined steering behaviors. E.g. pursue the target while avoiding obstacles and other vehicles, steer to the goal while evading enemies and avoiding obstacles… Update: done
  • Integrate vehicle.py with my NPC code to steer 3D animated characters over uneven terrain.

Also see IP Knightly’s steering demo which he released on the same day! :slight_smile:

Wow, that’s coool ! :smiley:
But, maybe you should use BillboardPointEye rather than BillboardAxis, so that the text won’t be disoriented, especially when the vehicle is far away from origin.

Yep. Thanks ynjh_jo!

Fix committed, same link as above.

Updated: download

Added obstacle avoidance steering behavior and demo (two vehicles chasing each other around some obstacles). Also refactored steerDemo.py so that it’s plugin oriented, add new demos as plugins without modifying steerDemo.py, very nice and easy.

Enjoy :slight_smile:

Thanks to ThomasEgi for helping me with some of the algebra.

Update: the project has been moved to panda3dprojects.com, thanks bigfoot29!

New link: chombee.panda3dprojects.com/PandaSteer.tar.gz

The above links have been fixed too.

Update: added collision avoidance steering (avoid other moving vehicles) plus new demos. Same download as in first post. I really can’t take credit for this new steering code, it was translated more or less directly from OpenSteer.