[ODE] Strategy to implement NPCs "visibility"

Megan Fox shalinor at gmail.com
Tue Oct 23 06:34:19 MST 2007


You would want to create some geoms in ODE that your custom collider
could recognize and not assign physical force to - flag them some way
in your code as "ghosts," that only return collision data to some kind
of callback system.

Having done that, it's a simple matter of attaching some of these
specially-flagged geoms to your entities, and whenever something
enters collision with the "eye" geom, then that entity can see the
collider - and when it leaves collision, your entity loses sight of
them.

You'd probably want to further extend this by using a ray geom, cast
between the entity's eyes and the target, where the ray geom's first
contact must be the "seen" entity for it to actually be seen (eg.
detect cases where your collision volume encompasses the target as
well as the wall dividing it from your entity)

Works fairly well.  I've used these ghost-style geoms for everything
from melee weapon collision volumes and shields to eyes and "ears"
(eyes have the visibility double-check ray, ears, not).

On 10/23/07, Jose Marin <jose_marin2 at yahoo.com.br> wrote:
> Hi.
>
> On the AI of my game, the NPCs (non-player character)  must be able to "see" the player.
>
> >From the eye position, the player it´s visible if he/she it´s inside a pyramid or cone with a, say, 60 degrees.
>
> It´s possible to use ODE to implement this?
>
> Other way it´s to cast a ray from the eye to the player, and if it doesn´t collide with anything, the player it´s visible.
>
> I would like to use ODE as the only collision system.
>
> Thanks
>
>
>       Abra sua conta no Yahoo! Mail, o único sem limite de espaço para armazenamento!
> http://br.mail.yahoo.com/
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
>


-- 
Megan Fox
Idyllon, LLC
http://www.shalinor.com/
http://www.idyllon.com/



More information about the ODE mailing list