Wall avoidance steering

Posted by Vodemki on Game Development See other posts from Game Development or by Vodemki
Published on 2012-12-11T18:38:27Z Indexed on 2012/12/11 23:15 UTC
Read the original article Hit count: 236

Filed under:

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.

© Game Development or respective owner

Related posts about steering-behaviors