Simple heuristic collision avoidance

posted in Gamedev info
Published January 26, 2015
Advertisement
Simple heuristic collision avoidance

Heuristic collison avoidance:


1. check for collision some distance in front of the player (say 15 feet).

2. if collsiosn is indicated:

2.a. check for collision ahead and to the left of player (15 feet ahead, and 15 feet left).

2.b. check for collision ahead and to the right of player (15 feet ahead, and 15 feet right).

2.c. if collsion left and not right, set the location ahead and to the right as the moveto location.

2.d. if collsion right and not left, set the location ahead and to the left as the moveto location.

2.e. if collsion left and right, go into collision recovery. there appears to be lots of stuff in front of us that we'll bounce off in a moment anyway.

2.f if not collision left or right, choose the left or right locaiton at random as the moveto location.

3. if you didn't go into collision recovery, move to the moveto location, then resume normal movement.

Note that in dense fields of obstacles, this algo does not work well, as the algo will tend to detect obctacles all about the player, causing oscillation between collision avoidance and collision recovery modes, resutling in a tendancy to turn about in place while searching for a way out of the obstacle field.
0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement