Jump to content
Sign in to follow this  
  • entries
    45
  • comments
    44
  • views
    51184

Simple heuristic collision avoidance

Sign in to follow this  
Norman Barrows

572 views

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  


0 Comments


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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!