Need Help with Steering and Collisions

Started by
3 comments, last by Emergent 14 years, 5 months ago
Hi, Let me first describe what I need help with: I have a few objects that move along a twisting tunnel. The objects are moving parallel to each other, in several rows and towards the same goal. The objects have a movement direction (2d vector) and a speed and I control them by adjusting those 2 parameters. The problem I am having is that as soon as there is a turn (of which there are many) the objects are all overlapping. The turning and pathfollowing works fine, but sooner or later they all align to the same path and disappear into a single mass of objects. I tried to implement the "Crowd Path Following" approach from "Steering Behaviors For Autonomous Characters " (http://www.red3d.com/cwr/steer/) but I somehow cannot get it to work. I do need some kind of collision detection and logic on how to prevent the overlapping of the objects but still let them move relatively clustered together towards their path. A problem is also that I need to control the objects individually (increase/decrease speed of one that then drops back or races ahead, etc...) triggered by outside events and therefore cannot use a kind of group approach. Did anyone of you do something like this and could give me a few pointers on how to handle this ?
Advertisement
I think all the crowd demos in Craig Reynolds' work use the concept of Avoidance. That's just another steering force. Do you have that in there?

Collision detection is a possible solution, but I don't think it's as simple to deploy as Avoidance.

Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!

Hi, I tried to implement avoidance by calculating a force vector for all objects in front and altering the course and speed according to that vector but the results were all pretty bad.

Do you maybe have a few more pointers on that topic ?
Actually, I had a brain fart when I wrote that first post. Avoidance would be to move away from walls. I meant Separation, which moves the agents away from their nearest neighbours. It's documented on Craig Reynold's site.

The idea is that it does what a physics collision algorithm would do, but in a much softer way (though not guaranteed to be perfect).


The hard part would be to figure out the strength of the avoidance force, which entities to take into account, and the weight for each one.

Alex

Join us in Vienna for the nucl.ai Conference 2015, on July 20-22... Don't miss it!

You can put all of this together in a single nice framework by just defining an appropriate potential function and always moving down its gradient. For instance, one that I like is a sum of logarithmic barrier functions (one for each thing I want to keep from happening), and quadratic functions (for each thing I like happening).

-----

The logarithmic barrier functions are of the form

barrier(x) = -log(1 - x)

where x=0 means "constraint not violated at all" and x=1 means "constraint being violated).


The quadratic reward functions are of the form,

reward(x) = -x^2

where x=0 means "good stuff happening."

------

Since your agents presumably cannot move in any direction, they can move in whatever direction moves most down this gradient.

This topic is closed to new replies.

Advertisement