#### Archived

This topic is now archived and is closed to further replies.

# contour tracing obstacle avoidance question

This topic is 5239 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

ive learnd a technique which is mentioned in windows game programming guru called contour tracing.it is basically said that when object hits a obstacle then trace around the edge of the obstacle until a clear path is found.i tried it in my game but found a serious problem with it.image the suitation is like this
-------------------
|  *     |
|        |
----  ----
A

where * is the player and A is the place AI got stuck on.how on earth the AI gonna know the right way of doing it is to trace the wall around the right rather than to the left and trace forever?i would be really appreciated if anyone can give me an advie.thanks. [edited by - jimywang on April 14, 2004 5:51:37 PM] [fixed the code box -Si] [edited by - SiCrane on April 14, 2004 6:33:43 PM]

##### Share on other sites
You could make a maxiumum trace amount, and then trace the other way. Just say like,

int traceLeft()
{
...
if pixelsTraced > maxTrace then
{
traceRight;
return 0;
}
...
return openPoint;
}

Or something along those lines.

##### Share on other sites
or check both ways simulatneously, and use whichever gets there first.

##### Share on other sites
"how on earth the AI gonna know the right way of doing it is to trace the wall around the right rather than to the left…."

WHO told it to trace to the left??

Stevie

1. 1
2. 2
3. 3
4. 4
frob
15
5. 5

• 16
• 12
• 20
• 12
• 19
• ### Forum Statistics

• Total Topics
632163
• Total Posts
3004513

×