Jump to content
  • Advertisement
Sign in to follow this  
  • entries
  • comments
  • views

Simple heuristic collision avoidance

Sign in to follow this  
Norman Barrows


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.
Sign in to follow this  


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!