Wall avoidance steering
- by Vodemki
I making a small steering simulator using the reynolds boid algorythm.
Now I want to add a wall avoidance feature. My walls are in 3D and defined using two points like that:
---------. P2
| |
P1 .---------
My agents have a velocity, a position, etc...
Could you tell me how to make avoidance with my agents ?
Vector2D ReynoldsSteeringModel::repulsionFromWalls()
{
Vector2D force;
vector<Wall *> wallsList = walls();
Point2D pos = self()->position();
Vector2D velocity = self()->velocity();
for (unsigned i=0; i<wallsList.size(); i++)
{
//TODO
}
return force;
}
Then I use all the forces returned by my boid functions and I apply it to my agent.
I just need to know how to do that with my walls ?
Thanks for your help.